@Singleton final class EntityInspectorImpl extends java.lang.Object implements EntityInspector
entity processors in
different contexts.| Modifier and Type | Field and Description |
|---|---|
private java.util.List<EntityProcessor> |
entityProcessors |
private EntityGraphProvider |
graphProvider |
| Constructor and Description |
|---|
EntityInspectorImpl(org.glassfish.hk2.api.ServiceLocator locator)
Constructor for HK2 expecting
ServiceLocator to be injected. |
| Modifier and Type | Method and Description |
|---|---|
void |
inspect(java.lang.Class<?> entityClass,
boolean forWriter)
Inspect entity class and create/update
EntityGraph for reader/writer. |
private boolean |
inspectEntityClass(java.lang.Class<?> entityClass,
EntityGraph graph,
boolean forWriter)
Invoke available
EntityProcessors on given entity class. |
private java.util.Map<java.lang.String,java.lang.reflect.Method> |
inspectEntityProperties(java.lang.Class<?> entityClass,
EntityGraph graph,
java.util.Set<java.lang.Class<?>> inspect,
boolean forWriter)
Invoke available
EntityProcessors on fields of given entity class. |
private void |
inspectStandaloneAccessors(java.util.Map<java.lang.String,java.lang.reflect.Method> unprocessedAccessors,
EntityGraph graph,
boolean forWriter)
Invoke available
EntityProcessors on accessors (getter/setter) that has no match in classes' fields. |
private final java.util.List<EntityProcessor> entityProcessors
@Inject private EntityGraphProvider graphProvider
@Inject public EntityInspectorImpl(org.glassfish.hk2.api.ServiceLocator locator)
ServiceLocator to be injected.locator - service locator to be injected.public void inspect(java.lang.Class<?> entityClass,
boolean forWriter)
EntityInspectorEntityGraph for reader/writer. The entity graph will be used to create
entity-filtering object which is requested by #createFilteringObject(...).
Method recursively inspects entity fields classes suitable for inspecting.
Method uses EntityProcessors for inspecting.
inspect in interface EntityInspectorentityClass - entity class to be examined.forWriter - flag determining whether the class should be examined for reader or writer.private boolean inspectEntityClass(java.lang.Class<?> entityClass,
EntityGraph graph,
boolean forWriter)
EntityProcessors on given entity class.entityClass - entity class to be examined.graph - entity graph to be modified by examination.forWriter - flag determining whether the class should be examined for reader or writer.true if the inspecting should be roll-backed, false otherwise.private java.util.Map<java.lang.String,java.lang.reflect.Method> inspectEntityProperties(java.lang.Class<?> entityClass,
EntityGraph graph,
java.util.Set<java.lang.Class<?>> inspect,
boolean forWriter)
EntityProcessors on fields of given entity class. Method returns a map (fieldName,
method) of unprocessed property accessors (getters/setters) and fills inspect set with entity classes
that should be further processed.entityClass - entity class to obtain properties to be examined.graph - entity graph to be modified by examination.inspect - non-null set of classes to-be-examined.forWriter - flag determining whether the class should be examined for reader or writer.private void inspectStandaloneAccessors(java.util.Map<java.lang.String,java.lang.reflect.Method> unprocessedAccessors,
EntityGraph graph,
boolean forWriter)
EntityProcessors on accessors (getter/setter) that has no match in classes' fields.unprocessedAccessors - map of unprocessed accessors.graph - entity graph to be modified by examination.forWriter - flag determining whether the class should be examined for reader or writer.