Class MapGenerator
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.generator.MapGenerator
-
- All Implemented Interfaces:
Function<Iterable<? extends Element>,Iterable<? extends Map<String,Object>>>
,ObjectGenerator<Map<String,Object>>
,OneToOneObjectGenerator<Map<String,Object>>
public class MapGenerator extends Object implements OneToOneObjectGenerator<Map<String,Object>>
AMapGenerator
is a generator which creates a representation of anElement
using aLinkedHashMap
.For example, providing an
Edge
with fields:- Group: "EdgeGroup"
- Source: "A"
- Destination: "B"
- Directed: true
- Property1: "propValue"
LinkedHashMap
, for which the fields will be represented as:
{ GROUP: "EdgeGroup", SOURCE: "A", DESTINATION: "B", DIRECTED: "true" PROPERTY1: "propValue" }
Any constants relevant to a particular
Element
can be added, and will be stored in a separateLinkedHashMap
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MapGenerator.Builder
-
Constructor Summary
Constructors Constructor Description MapGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
_apply(Element element)
LinkedHashMap<String,String>
getConstants()
LinkedHashMap<String,String>
getFields()
void
setConstants(LinkedHashMap<String,String> constants)
void
setFields(LinkedHashMap<String,String> fields)
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.gov.gchq.gaffer.data.generator.OneToOneObjectGenerator
apply
-
-
-
-
Field Detail
-
GROUP
public static final String GROUP
- See Also:
- Constant Field Values
-
-
Method Detail
-
_apply
public Map<String,Object> _apply(Element element)
- Specified by:
_apply
in interfaceOneToOneObjectGenerator<Map<String,Object>>
- Parameters:
element
- the element to convert- Returns:
- the generated domain object
-
getFields
public LinkedHashMap<String,String> getFields()
-
setFields
public void setFields(LinkedHashMap<String,String> fields)
-
getConstants
public LinkedHashMap<String,String> getConstants()
-
setConstants
public void setConstants(LinkedHashMap<String,String> constants)
-
-