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<?>
entityClass
private com.google.common.collect.HashMultimap<java.lang.String,java.lang.String>
fields
private java.util.Set<java.lang.String>
globalScopes
private java.util.Set<java.lang.String>
localScopes
private 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 EntityGraphImpl
addField(java.lang.String fieldName)
Add a field into this graph for all existing entity-filtering scopes.EntityGraphImpl
addField(java.lang.String fieldName, java.lang.String... filteringScopes)
Add a field into this graph for given list of entity-filtering scopes.EntityGraphImpl
addField(java.lang.String fieldName, java.util.Set<java.lang.String> filteringScopes)
Add a field into this graph for given set of entity-filtering scopes.EntityGraphImpl
addFilteringScopes(java.util.Set<java.lang.String> filteringScopes)
Add a set of entity-filtering scopes to this graph.EntityGraphImpl
addSubgraph(java.lang.String fieldName, java.lang.Class<?> fieldClass)
Add a subgraph into this graph for all existing entity-filtering scopes.EntityGraphImpl
addSubgraph(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.EntityGraphImpl
addSubgraph(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 void
createFilteringScope(java.lang.String filteringScope)
Create a new entity-filtering scope based on thedefault one
.boolean
equals(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.int
hashCode()
boolean
presentInScope(java.lang.String field, java.lang.String filteringScope)
Determines whether a field/subgraph is present in ANY of the given scopes.boolean
presentInScopes(java.lang.String name)
Determines whether a field/subgraph is present in ANY of the existing scopes.EntityGraphImpl
remove(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:EntityGraph
Add a field into this graph for all existing entity-filtering scopes.- Specified by:
addField
in 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:EntityGraph
Add a field into this graph for given list of entity-filtering scopes.- Specified by:
addField
in 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:EntityGraph
Add a field into this graph for given set of entity-filtering scopes.- Specified by:
addField
in 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:EntityGraph
Add a set of entity-filtering scopes to this graph.- Specified by:
addFilteringScopes
in 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:EntityGraph
Add a subgraph into this graph for all existing entity-filtering scopes.- Specified by:
addSubgraph
in 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:EntityGraph
Add a subgraph into this graph for given list of entity-filtering scopes.- Specified by:
addSubgraph
in 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:EntityGraph
Add a subgraph into this graph for given set of entity-filtering scopes.- Specified by:
addSubgraph
in 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:EntityGraph
Get an entity class this graph is created for.- Specified by:
getEntityClass
in interfaceEntityGraph
- Returns:
- an entity class.
-
getFields
public java.util.Set<java.lang.String> getFields(java.lang.String filteringScope)
Description copied from interface:EntityGraph
Get fields for given entity-filtering scope.- Specified by:
getFields
in 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:EntityGraph
Get fields for given entity-filtering scopes.- Specified by:
getFields
in 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:EntityGraph
Get fields for given entity-filtering scopes.- Specified by:
getFields
in 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:EntityGraph
Get all available entity-filtering scopes.- Specified by:
getFilteringScopes
in interfaceEntityGraph
- Returns:
- all available entity-filtering scopes.
-
getClassFilteringScopes
public java.util.Set<java.lang.String> getClassFilteringScopes()
Description copied from interface:EntityGraph
Get all available entity-filtering scopes defined on a class.- Specified by:
getClassFilteringScopes
in 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:EntityGraph
Get subgraphs for given entity-filtering scope.- Specified by:
getSubgraphs
in 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:EntityGraph
Get subgraphs for given entity-filtering scopes.- Specified by:
getSubgraphs
in 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:EntityGraph
Get subgraphs for given entity-filtering scopes.- Specified by:
getSubgraphs
in 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:EntityGraph
Determines whether a field/subgraph is present in ANY of the existing scopes.- Specified by:
presentInScopes
in interfaceEntityGraph
- Parameters:
name
- field to be checked.- Returns:
true
if field is present in ANY of the existing scopes,false
otherwise.
-
presentInScope
public boolean presentInScope(java.lang.String field, java.lang.String filteringScope)
Description copied from interface:EntityGraph
Determines 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:
presentInScope
in interfaceEntityGraph
- Parameters:
field
- field to be checked.filteringScope
- entity-filtering scope.- Returns:
true
if field is present in the given scope,false
otherwise.
-
remove
public EntityGraphImpl remove(java.lang.String fieldName)
Description copied from interface:EntityGraph
Remove a field/subgraph from the graph (all entity-filtering scopes).- Specified by:
remove
in 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-