Class CommonScopeProvider

java.lang.Object
org.glassfish.jersey.message.filtering.CommonScopeProvider
All Implemented Interfaces:
ScopeProvider
Direct Known Subclasses:
ServerScopeProvider

@Singleton class CommonScopeProvider extends Object implements ScopeProvider
Default implementation of scope provider. This class can be used on client to retrieve entity-filtering scopes from given entity annotations or injected configuration. Class can also serve as a base class for server-side implementations.
See Also:
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • resolvers

      private final List<ScopeResolver> resolvers
    • config

      private final javax.ws.rs.core.Configuration config
  • Constructor Details

    • CommonScopeProvider

      @Inject public CommonScopeProvider(javax.ws.rs.core.Configuration config, InjectionManager injectionManager)
      Create new common scope provider with injected configuration and injection manager.
  • Method Details

    • getFilteringScopes

      public Set<String> getFilteringScopes(Annotation[] entityAnnotations, boolean defaultIfNotFound)
      Description copied from interface: ScopeProvider
      Get entity-filtering scopes to be used to process an entity.
      Specified by:
      getFilteringScopes in interface ScopeProvider
      Parameters:
      entityAnnotations - entity annotations provided with entity when creating request/response.
      defaultIfNotFound - flag determining whether the default entity-filtering scope should be returned if no other scope can be obtained.
      Returns:
      non-null entity-filtering scopes.
    • returnFilteringScopes

      protected Set<String> returnFilteringScopes(Set<String> filteringScopes, boolean returnDefaultFallback)
      Return the default entity-filtering scope if the given set of scopes is empty and the processing should fallback to the default.
      Parameters:
      filteringScopes - entity-filtering scopes to be examined.
      returnDefaultFallback - true if the default entity-filtering scope should be returned if the given scopes are empty, false otherwise.
      Returns:
      entity-filtering scopes.
    • getFilteringScopes

      protected Set<String> getFilteringScopes(Annotation[] annotations)
      Get entity-filtering scopes from all available scope resolvers for given annotations.
      Parameters:
      annotations - annotations to retrieve entity-filtering scopes from.
      Returns:
      entity-filtering scopes or an empty set if none scope can be resolved.
    • getFilteringScopes

      private Set<String> getFilteringScopes(javax.ws.rs.core.Configuration config)
      Get entity-filtering scopes from Configuration.
      Parameters:
      config - configuration the entity-filtering scopes are obtained from.
      Returns:
      entity-filtering scopes or an empty set if none scope can be resolved.
    • mergeFilteringScopes

      protected void mergeFilteringScopes(Set<String> filteringScopes, Set<String> resolvedScopes)
      Merge two sets of entity-filtering scopes.
      Parameters:
      filteringScopes - existing entity-filtering scopes.
      resolvedScopes - entity-filtering scopes to be added to the existing ones.