Class ElementDefinitions<ENTITY_DEF extends ElementDefinition,EDGE_DEF extends ElementDefinition>
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.elementdefinition.ElementDefinitions<ENTITY_DEF,EDGE_DEF>
-
- Type Parameters:
ENTITY_DEF
- the type ofElementDefinition
for the entitiesEDGE_DEF
- the type ofElementDefinition
for the edges
public class ElementDefinitions<ENTITY_DEF extends ElementDefinition,EDGE_DEF extends ElementDefinition> extends Object
Contains the full list of groups in the graph.
This class must be JSON serialisable. A schema should normally be written in JSON and then deserialised at runtime. Examples of JSON schemas can be found in the example projects.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ElementDefinitions.BaseBuilder<ELEMENT_DEFS extends ElementDefinitions<ENTITY_DEF,EDGE_DEF>,ENTITY_DEF extends ElementDefinition,EDGE_DEF extends ElementDefinition,CHILD_CLASS extends ElementDefinitions.BaseBuilder<ELEMENT_DEFS,ENTITY_DEF,EDGE_DEF,?>>
Builder forElementDefinitions
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
EDGE_DEF
getEdge(String group)
Set<String>
getEdgeGroups()
Map<String,EDGE_DEF>
getEdges()
ElementDefinition
getElement(String group)
Looks the group up in the entity definitions then if it doesn't find a definition it will look it up in the edge definitions.Map<String,ENTITY_DEF>
getEntities()
ENTITY_DEF
getEntity(String group)
Set<String>
getEntityGroups()
Set<String>
getGroups()
Returns a new hash set with all entity and edge groups.boolean
hasEdges()
boolean
hasEntities()
boolean
hasGroups()
int
hashCode()
boolean
isEdge(String group)
boolean
isEntity(String group)
byte[]
toJson(boolean prettyPrint, String... fieldsToExclude)
String
toString()
-
-
-
Method Detail
-
toJson
public byte[] toJson(boolean prettyPrint, String... fieldsToExclude) throws SchemaException
- Throws:
SchemaException
-
getElement
public ElementDefinition getElement(String group)
Looks the group up in the entity definitions then if it doesn't find a definition it will look it up in the edge definitions. If you know the type of the element (Entity or Edge) then use getEntity or getEdge.- Parameters:
group
- an group- Returns:
- the
ElementDefinition
for the given group
-
getEntity
public ENTITY_DEF getEntity(String group)
-
isEntity
public boolean isEntity(String group)
-
isEdge
public boolean isEdge(String group)
-
getGroups
public Set<String> getGroups()
Returns a new hash set with all entity and edge groups.- Returns:
- a new hash set with all entity and edge groups.
-
hasEntities
public boolean hasEntities()
-
hasEdges
public boolean hasEdges()
-
hasGroups
public boolean hasGroups()
-
getEntities
public Map<String,ENTITY_DEF> getEntities()
-
-