1
1
/*
2
- * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
3
3
*
4
4
* This program and the accompanying materials are made available under the
5
5
* terms of the Eclipse Public License v. 2.0, which is available at
50
50
*/
51
51
@ Singleton
52
52
final class EntityInspectorImpl implements EntityInspector {
53
-
54
53
private final List <EntityProcessor > entityProcessors ;
55
54
56
55
@ Inject
@@ -71,21 +70,26 @@ public EntityInspectorImpl(final InjectionManager injectionManager) {
71
70
@ Override
72
71
public void inspect (final Class <?> entityClass , final boolean forWriter ) {
73
72
if (!graphProvider .containsEntityGraph (entityClass , forWriter )) {
74
- final EntityGraph graph = graphProvider . getOrCreateEntityGraph (entityClass , forWriter );
73
+ final EntityGraph graph = new EntityGraphImpl (entityClass );
75
74
final Set <Class <?>> inspect = new HashSet <>();
76
75
77
76
// Class.
78
77
if (!inspectEntityClass (entityClass , graph , forWriter )) {
79
78
// Properties.
80
- final Map <String , Method > unmatchedAccessors = inspectEntityProperties (entityClass , graph , inspect , forWriter );
79
+ final Map <String , Method > unmatchedAccessors =
80
+ inspectEntityProperties (entityClass , graph , inspect , forWriter );
81
81
82
82
// Setters/Getters without fields.
83
83
inspectStandaloneAccessors (unmatchedAccessors , graph , forWriter );
84
84
85
+ graphProvider .putIfAbsent (entityClass , graph , forWriter );
86
+
85
87
// Inspect new classes.
86
88
for (final Class <?> clazz : inspect ) {
87
89
inspect (clazz , forWriter );
88
90
}
91
+ } else {
92
+ graphProvider .putIfAbsent (entityClass , graph , forWriter );
89
93
}
90
94
}
91
95
}
0 commit comments