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 Object implements EntityProcessor
Common entity processor supposed to be used as a base class for custom implementations. Provides convenient methods for adding entity-filtering scopes to entity graph as well as a common implementation of process(org.glassfish.jersey.message.filtering.spi.EntityProcessorContext).
  • Constructor Details

    • AbstractEntityProcessor

      public AbstractEntityProcessor()
  • Method Details

    • process

      Description copied from interface: EntityProcessor
      Process given (class/property/accessor) context by modifying provided EntityGraph.
      Specified by:
      process in interface EntityProcessor
      Parameters:
      context - context to be processed.
      Returns:
      result of processing a context.
    • getAnnotations

      private Annotation[] getAnnotations(AccessibleObject accessibleObject)
    • process

      protected EntityProcessor.Result process(String fieldName, Class<?> fieldClass, Annotation[] fieldAnnotations, Annotation[] annotations, EntityGraph graph)
      Method is called from the default implementation of process(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 be null).
      fieldClass - class of the field (can be null).
      fieldAnnotations - annotations associated with the field (cannot be null).
      annotations - annotations associated with class/accessor (cannot be null).
      graph - entity graph to be processed.
      Returns:
      result of the processing (default is EntityProcessor.Result.SKIP).
    • addFilteringScopes

      protected final void addFilteringScopes(String field, Class<?> fieldClass, Set<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(Set<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.