Class AbstractEntityProcessor
- java.lang.Object
-
- org.glassfish.jersey.message.filtering.spi.AbstractEntityProcessor
-
- All Implemented Interfaces:
EntityProcessor
- Direct Known Subclasses:
DefaultEntityProcessor
,EntityFilteringProcessor
,SecurityEntityProcessor
,SelectableEntityProcessor
public abstract class AbstractEntityProcessor extends java.lang.Object implements EntityProcessor
Commonentity processor
supposed to be used as a base class for custom implementations. Provides convenient methods for adding entity-filtering scopes toentity graph
as well as a common implementation ofprocess(org.glassfish.jersey.message.filtering.spi.EntityProcessorContext)
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.jersey.message.filtering.spi.EntityProcessor
EntityProcessor.Result
-
-
Constructor Summary
Constructors Constructor Description AbstractEntityProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addFilteringScopes(java.lang.String field, java.lang.Class<?> fieldClass, java.util.Set<java.lang.String> filteringScopes, EntityGraph graph)
Add entity-filtering scopes of a field to an entity-graph.protected void
addGlobalScopes(java.util.Set<java.lang.String> filteringScopes, EntityGraph graph)
Add entity-filtering scopes into given graph.private java.lang.annotation.Annotation[]
getAnnotations(java.lang.reflect.AccessibleObject accessibleObject)
protected EntityProcessor.Result
process(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.lang.annotation.Annotation[] fieldAnnotations, java.lang.annotation.Annotation[] annotations, EntityGraph graph)
Method is called from the default implementation ofprocess(org.glassfish.jersey.message.filtering.spi.EntityProcessorContext)
and is supposed to be overridden by custom implementations of this class.EntityProcessor.Result
process(EntityProcessorContext context)
Process given (class/property/accessor)context
by modifying providedEntityGraph
.
-
-
-
Method Detail
-
process
public EntityProcessor.Result process(EntityProcessorContext context)
Description copied from interface:EntityProcessor
Process given (class/property/accessor)context
by modifying providedEntityGraph
.- Specified by:
process
in interfaceEntityProcessor
- Parameters:
context
- context to be processed.- Returns:
- result of processing a context.
-
getAnnotations
private java.lang.annotation.Annotation[] getAnnotations(java.lang.reflect.AccessibleObject accessibleObject)
-
process
protected EntityProcessor.Result process(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.lang.annotation.Annotation[] fieldAnnotations, java.lang.annotation.Annotation[] annotations, EntityGraph graph)
Method is called from the default implementation ofprocess(org.glassfish.jersey.message.filtering.spi.EntityProcessorContext)
and is supposed to be overridden by custom implementations of this class.- Parameters:
fieldName
- name of the field (can benull
).fieldClass
- class of the field (can benull
).fieldAnnotations
- annotations associated with the field (cannot benull
).annotations
- annotations associated with class/accessor (cannot benull
).graph
- entity graph to be processed.- Returns:
- result of the processing (default is
EntityProcessor.Result.SKIP
).
-
addFilteringScopes
protected final void addFilteringScopes(java.lang.String field, java.lang.Class<?> fieldClass, java.util.Set<java.lang.String> filteringScopes, EntityGraph graph)
Add entity-filtering scopes of a field to an entity-graph. The method determines whether the field should be added as a simple field or a subgraph.- Parameters:
field
- name of a field to be added to the graph.fieldClass
- class of the field.filteringScopes
- entity-filtering scopes the field will be associated with in the graph.graph
- entity graph the field will be added to.
-
addGlobalScopes
protected final void addGlobalScopes(java.util.Set<java.lang.String> filteringScopes, EntityGraph graph)
Add entity-filtering scopes into given graph. This method should be called only in class-level context.- Parameters:
filteringScopes
- entity-filtering scopes to be added to graph.graph
- entity graph to be enhanced by new scopes.
-
-