Class EntityGraphImpl
- java.lang.Object
-
- org.glassfish.jersey.message.filtering.EntityGraphImpl
-
- All Implemented Interfaces:
EntityGraph
final class EntityGraphImpl extends java.lang.Object implements EntityGraph
Default implementation ofEntityGraph.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>entityClassprivate com.google.common.collect.HashMultimap<java.lang.String,java.lang.String>fieldsprivate java.util.Set<java.lang.String>globalScopesprivate java.util.Set<java.lang.String>localScopesprivate com.google.common.collect.Table<java.lang.String,java.lang.String,java.lang.Class<?>>subgraphs
-
Constructor Summary
Constructors Constructor Description EntityGraphImpl(java.lang.Class<?> entityClass)Create an entity graph for given class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EntityGraphImpladdField(java.lang.String fieldName)Add a field into this graph for all existing entity-filtering scopes.EntityGraphImpladdField(java.lang.String fieldName, java.lang.String... filteringScopes)Add a field into this graph for given list of entity-filtering scopes.EntityGraphImpladdField(java.lang.String fieldName, java.util.Set<java.lang.String> filteringScopes)Add a field into this graph for given set of entity-filtering scopes.EntityGraphImpladdFilteringScopes(java.util.Set<java.lang.String> filteringScopes)Add a set of entity-filtering scopes to this graph.EntityGraphImpladdSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass)Add a subgraph into this graph for all existing entity-filtering scopes.EntityGraphImpladdSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.lang.String... filteringScopes)Add a subgraph into this graph for given list of entity-filtering scopes.EntityGraphImpladdSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.util.Set<java.lang.String> filteringScopes)Add a subgraph into this graph for given set of entity-filtering scopes.private voidcreateFilteringScope(java.lang.String filteringScope)Create a new entity-filtering scope based on thedefault one.booleanequals(java.lang.Object o)java.util.Set<java.lang.String>getClassFilteringScopes()Get all available entity-filtering scopes defined on a class.java.lang.Class<?>getEntityClass()Get an entity class this graph is created for.java.util.Set<java.lang.String>getFields(java.lang.String filteringScope)Get fields for given entity-filtering scope.java.util.Set<java.lang.String>getFields(java.lang.String... filteringScopes)Get fields for given entity-filtering scopes.java.util.Set<java.lang.String>getFields(java.util.Set<java.lang.String> filteringScopes)Get fields for given entity-filtering scopes.java.util.Set<java.lang.String>getFilteringScopes()Get all available entity-filtering scopes.java.util.Map<java.lang.String,java.lang.Class<?>>getSubgraphs(java.lang.String filteringScope)Get subgraphs for given entity-filtering scope.java.util.Map<java.lang.String,java.lang.Class<?>>getSubgraphs(java.lang.String... filteringScopes)Get subgraphs for given entity-filtering scopes.java.util.Map<java.lang.String,java.lang.Class<?>>getSubgraphs(java.util.Set<java.lang.String> filteringScopes)Get subgraphs for given entity-filtering scopes.inthashCode()booleanpresentInScope(java.lang.String field, java.lang.String filteringScope)Determines whether a field/subgraph is present in ANY of the given scopes.booleanpresentInScopes(java.lang.String name)Determines whether a field/subgraph is present in ANY of the existing scopes.EntityGraphImplremove(java.lang.String fieldName)Remove a field/subgraph from the graph (all entity-filtering scopes).
-
-
-
Field Detail
-
entityClass
private final java.lang.Class<?> entityClass
-
globalScopes
private final java.util.Set<java.lang.String> globalScopes
-
localScopes
private final java.util.Set<java.lang.String> localScopes
-
fields
private final com.google.common.collect.HashMultimap<java.lang.String,java.lang.String> fields
-
subgraphs
private final com.google.common.collect.Table<java.lang.String,java.lang.String,java.lang.Class<?>> subgraphs
-
-
Method Detail
-
addField
public EntityGraphImpl addField(java.lang.String fieldName)
Description copied from interface:EntityGraphAdd a field into this graph for all existing entity-filtering scopes.- Specified by:
addFieldin interfaceEntityGraph- Parameters:
fieldName- name of the field to be added.- Returns:
- an entity-filtering graph instance.
-
addField
public EntityGraphImpl addField(java.lang.String fieldName, java.lang.String... filteringScopes)
Description copied from interface:EntityGraphAdd a field into this graph for given list of entity-filtering scopes.- Specified by:
addFieldin interfaceEntityGraph- Parameters:
fieldName- name of the field to be added.filteringScopes- entity-filtering scopes for the field.- Returns:
- an entity-filtering graph instance.
-
addField
public EntityGraphImpl addField(java.lang.String fieldName, java.util.Set<java.lang.String> filteringScopes)
Description copied from interface:EntityGraphAdd a field into this graph for given set of entity-filtering scopes.- Specified by:
addFieldin interfaceEntityGraph- Parameters:
fieldName- name of the field to be added.filteringScopes- entity-filtering scopes for the field.- Returns:
- an entity-filtering graph instance.
-
addFilteringScopes
public EntityGraphImpl addFilteringScopes(java.util.Set<java.lang.String> filteringScopes)
Description copied from interface:EntityGraphAdd a set of entity-filtering scopes to this graph.- Specified by:
addFilteringScopesin interfaceEntityGraph- Parameters:
filteringScopes- entity-filtering scopes to be added.- Returns:
- an entity-filtering graph instance.
-
addSubgraph
public EntityGraphImpl addSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass)
Description copied from interface:EntityGraphAdd a subgraph into this graph for all existing entity-filtering scopes.- Specified by:
addSubgraphin interfaceEntityGraph- Parameters:
fieldName- name of the subgraph field to be added.fieldClass- entity class representing the subgraph.- Returns:
- an entity-filtering graph instance.
-
addSubgraph
public EntityGraphImpl addSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.lang.String... filteringScopes)
Description copied from interface:EntityGraphAdd a subgraph into this graph for given list of entity-filtering scopes.- Specified by:
addSubgraphin interfaceEntityGraph- Parameters:
fieldName- name of the subgraph field to be added.fieldClass- entity class representing the subgraph.filteringScopes- entity-filtering scopes for the subgraph.- Returns:
- an entity-filtering graph instance.
-
addSubgraph
public EntityGraphImpl addSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass, java.util.Set<java.lang.String> filteringScopes)
Description copied from interface:EntityGraphAdd a subgraph into this graph for given set of entity-filtering scopes.- Specified by:
addSubgraphin interfaceEntityGraph- Parameters:
fieldName- name of the subgraph field to be added.fieldClass- entity class representing the subgraph.filteringScopes- entity-filtering scopes for the subgraph.- Returns:
- an entity-filtering graph instance.
-
getEntityClass
public java.lang.Class<?> getEntityClass()
Description copied from interface:EntityGraphGet an entity class this graph is created for.- Specified by:
getEntityClassin interfaceEntityGraph- Returns:
- an entity class.
-
getFields
public java.util.Set<java.lang.String> getFields(java.lang.String filteringScope)
Description copied from interface:EntityGraphGet fields for given entity-filtering scope.- Specified by:
getFieldsin interfaceEntityGraph- Parameters:
filteringScope- scope the returned fields have to be in.- Returns:
- set of fields present in given scope.
-
getFields
public java.util.Set<java.lang.String> getFields(java.lang.String... filteringScopes)
Description copied from interface:EntityGraphGet fields for given entity-filtering scopes.- Specified by:
getFieldsin interfaceEntityGraph- Parameters:
filteringScopes- scopes the returned fields have to be in.- Returns:
- set of fields present in given scopes.
-
getFields
public java.util.Set<java.lang.String> getFields(java.util.Set<java.lang.String> filteringScopes)
Description copied from interface:EntityGraphGet fields for given entity-filtering scopes.- Specified by:
getFieldsin interfaceEntityGraph- Parameters:
filteringScopes- scopes the returned fields have to be in.- Returns:
- set of fields present in given scopes.
-
getFilteringScopes
public java.util.Set<java.lang.String> getFilteringScopes()
Description copied from interface:EntityGraphGet all available entity-filtering scopes.- Specified by:
getFilteringScopesin interfaceEntityGraph- Returns:
- all available entity-filtering scopes.
-
getClassFilteringScopes
public java.util.Set<java.lang.String> getClassFilteringScopes()
Description copied from interface:EntityGraphGet all available entity-filtering scopes defined on a class.- Specified by:
getClassFilteringScopesin interfaceEntityGraph- Returns:
- all available entity-filtering scopes.
-
getSubgraphs
public java.util.Map<java.lang.String,java.lang.Class<?>> getSubgraphs(java.lang.String filteringScope)
Description copied from interface:EntityGraphGet subgraphs for given entity-filtering scope.- Specified by:
getSubgraphsin interfaceEntityGraph- Parameters:
filteringScope- scope the returned subgraphs have to be in.- Returns:
- map of subgraphs present in given scope.
-
getSubgraphs
public java.util.Map<java.lang.String,java.lang.Class<?>> getSubgraphs(java.lang.String... filteringScopes)
Description copied from interface:EntityGraphGet subgraphs for given entity-filtering scopes.- Specified by:
getSubgraphsin interfaceEntityGraph- Parameters:
filteringScopes- scopes the returned subgraphs have to be in.- Returns:
- map of subgraphs present in given scopes.
-
getSubgraphs
public java.util.Map<java.lang.String,java.lang.Class<?>> getSubgraphs(java.util.Set<java.lang.String> filteringScopes)
Description copied from interface:EntityGraphGet subgraphs for given entity-filtering scopes.- Specified by:
getSubgraphsin interfaceEntityGraph- Parameters:
filteringScopes- scopes the returned subgraphs have to be in.- Returns:
- map of subgraphs present in given scopes.
-
presentInScopes
public boolean presentInScopes(java.lang.String name)
Description copied from interface:EntityGraphDetermines whether a field/subgraph is present in ANY of the existing scopes.- Specified by:
presentInScopesin interfaceEntityGraph- Parameters:
name- field to be checked.- Returns:
trueif field is present in ANY of the existing scopes,falseotherwise.
-
presentInScope
public boolean presentInScope(java.lang.String field, java.lang.String filteringScope)Description copied from interface:EntityGraphDetermines whether a field/subgraph is present in ANY of the given scopes. If no scopes are given the return value determines whether the field is present in any scope.- Specified by:
presentInScopein interfaceEntityGraph- Parameters:
field- field to be checked.filteringScope- entity-filtering scope.- Returns:
trueif field is present in the given scope,falseotherwise.
-
remove
public EntityGraphImpl remove(java.lang.String fieldName)
Description copied from interface:EntityGraphRemove a field/subgraph from the graph (all entity-filtering scopes).- Specified by:
removein interfaceEntityGraph- Parameters:
fieldName- name of the field/subgraph to be removed.- Returns:
- an entity-filtering graph instance.
-
createFilteringScope
private void createFilteringScope(java.lang.String filteringScope)
Create a new entity-filtering scope based on thedefault one.- Parameters:
filteringScope- entity-filtering scope to be created.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-