Class EntityInspectorImpl
- java.lang.Object
-
- org.glassfish.jersey.message.filtering.EntityInspectorImpl
-
- All Implemented Interfaces:
EntityInspector
@Singleton final class EntityInspectorImpl extends java.lang.Object implements EntityInspector
Class responsible for inspecting entity classes. This class invokes all availableentity processors
in differentcontexts
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<EntityProcessor>
entityProcessors
private EntityGraphProvider
graphProvider
-
Constructor Summary
Constructors Constructor Description EntityInspectorImpl(InjectionManager injectionManager)
Constructor expectingInjectionManager
to be injected.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
inspect(java.lang.Class<?> entityClass, boolean forWriter)
Inspect entity class and create/updateEntityGraph
for reader/writer.private boolean
inspectEntityClass(java.lang.Class<?> entityClass, EntityGraph graph, boolean forWriter)
Invoke availableEntityProcessor
s 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 availableEntityProcessor
s 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 availableEntityProcessor
s on accessors (getter/setter) that has no match in classes' fields.
-
-
-
Field Detail
-
entityProcessors
private final java.util.List<EntityProcessor> entityProcessors
-
graphProvider
@Inject private EntityGraphProvider graphProvider
-
-
Constructor Detail
-
EntityInspectorImpl
@Inject public EntityInspectorImpl(InjectionManager injectionManager)
Constructor expectingInjectionManager
to be injected.- Parameters:
injectionManager
- injection manager to be injected.
-
-
Method Detail
-
inspect
public void inspect(java.lang.Class<?> entityClass, boolean forWriter)
Description copied from interface:EntityInspector
Inspect entity class and create/updateEntityGraph
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
EntityProcessor
s for inspecting.- Specified by:
inspect
in interfaceEntityInspector
- Parameters:
entityClass
- entity class to be examined.forWriter
- flag determining whether the class should be examined for reader or writer.
-
inspectEntityClass
private boolean inspectEntityClass(java.lang.Class<?> entityClass, EntityGraph graph, boolean forWriter)
Invoke availableEntityProcessor
s on given entity class.- Parameters:
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.- Returns:
true
if the inspecting should be roll-backed,false
otherwise.
-
inspectEntityProperties
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 availableEntityProcessor
s on fields of given entity class. Method returns a map (fieldName
,method
) of unprocessed property accessors (getters/setters) and fillsinspect
set with entity classes that should be further processed.- Parameters:
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.- Returns:
- map of unprocessed property accessors.
-
inspectStandaloneAccessors
private void inspectStandaloneAccessors(java.util.Map<java.lang.String,java.lang.reflect.Method> unprocessedAccessors, EntityGraph graph, boolean forWriter)
Invoke availableEntityProcessor
s on accessors (getter/setter) that has no match in classes' fields.- Parameters:
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.
-
-