@Singleton class CommonScopeProvider extends java.lang.Object implements ScopeProvider
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.ServerScopeProvider
Modifier and Type | Field and Description |
---|---|
private javax.ws.rs.core.Configuration |
config |
private static java.util.logging.Logger |
LOGGER |
private java.util.List<ScopeResolver> |
resolvers |
DEFAULT_SCOPE
Constructor and Description |
---|
CommonScopeProvider(javax.ws.rs.core.Configuration config,
InjectionManager injectionManager)
Create new common scope provider with injected
configuration and
injection manager . |
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<java.lang.String> |
getFilteringScopes(java.lang.annotation.Annotation[] annotations)
Get entity-filtering scopes from all available
scope resolvers for given annotations. |
java.util.Set<java.lang.String> |
getFilteringScopes(java.lang.annotation.Annotation[] entityAnnotations,
boolean defaultIfNotFound)
Get entity-filtering scopes to be used to process an entity.
|
private java.util.Set<java.lang.String> |
getFilteringScopes(javax.ws.rs.core.Configuration config)
Get entity-filtering scopes from
Configuration . |
protected void |
mergeFilteringScopes(java.util.Set<java.lang.String> filteringScopes,
java.util.Set<java.lang.String> resolvedScopes)
Merge two sets of entity-filtering scopes.
|
protected java.util.Set<java.lang.String> |
returnFilteringScopes(java.util.Set<java.lang.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.
|
private static final java.util.logging.Logger LOGGER
private final java.util.List<ScopeResolver> resolvers
private final javax.ws.rs.core.Configuration config
@Inject public CommonScopeProvider(javax.ws.rs.core.Configuration config, InjectionManager injectionManager)
configuration
and
injection manager
.public java.util.Set<java.lang.String> getFilteringScopes(java.lang.annotation.Annotation[] entityAnnotations, boolean defaultIfNotFound)
ScopeProvider
getFilteringScopes
in interface ScopeProvider
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.protected java.util.Set<java.lang.String> returnFilteringScopes(java.util.Set<java.lang.String> filteringScopes, boolean returnDefaultFallback)
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.protected java.util.Set<java.lang.String> getFilteringScopes(java.lang.annotation.Annotation[] annotations)
scope resolvers
for given annotations.annotations
- annotations to retrieve entity-filtering scopes from.private java.util.Set<java.lang.String> getFilteringScopes(javax.ws.rs.core.Configuration config)
Configuration
.config
- configuration the entity-filtering scopes are obtained from.protected void mergeFilteringScopes(java.util.Set<java.lang.String> filteringScopes, java.util.Set<java.lang.String> resolvedScopes)
filteringScopes
- existing entity-filtering scopes.resolvedScopes
- entity-filtering scopes to be added to the existing ones.