Class CsvGenerator.Builder
- java.lang.Object
-
- uk.gov.gchq.gaffer.data.generator.CsvGenerator.Builder
-
- Enclosing class:
- CsvGenerator
public static class CsvGenerator.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CsvGenerator
build()
Passes all the configured fields and constants about anElement
to a newCsvGenerator
, including the comma replacement String, and the flag for whether values should be quoted.CsvGenerator.Builder
commaReplacement(String commaReplacement)
Stores the String with which any encountered commas will be replaced.CsvGenerator.Builder
constant(String key, String value)
Stores any constants specific to a givenElement
.CsvGenerator.Builder
destination(String columnHeader)
Stores the Destination Vertex of anEntity
CsvGenerator.Builder
direction(String columnHeader)
Stores the Direction flag, indicating whether or not theEdge
is directed.CsvGenerator.Builder
edgeGroup(String columnHeader)
Stores the group of anEdge
on a seperate column.CsvGenerator.Builder
entityGroup(String columnHeader)
Stores the group of anEntity
on a seperate column.CsvGenerator.Builder
group(String columnHeader)
Stores the group of anElement
.CsvGenerator.Builder
identifier(IdentifierType identifierType, String columnHeader)
Allows anIdentifierType
of anElement
to be stored, such as anEdge
'sIdentifierType.MATCHED_VERTEX
.CsvGenerator.Builder
property(String propertyName, String columnHeader)
Stores any additional properties of anElement
.
For example: property("count", "3").
This would add the "count" property with a value of "3"CsvGenerator.Builder
quoted(boolean quoted)
Stores the flag for whether or not each distinct value should be wrapped in quotation marks.CsvGenerator.Builder
setAdditionalFieldsFromSchemaProperties(LinkedHashMap<String,Class<?>> schemaProperties)
Saves all properties from the schema which be added to fields.CsvGenerator.Builder
source(String columnHeader)
Stores the Source Vertex of anEdge
.CsvGenerator.Builder
vertex(String columnHeader)
Stores the Vertex of anEntity
-
-
-
Method Detail
-
group
public CsvGenerator.Builder group(String columnHeader)
Stores the group of anElement
.- Parameters:
columnHeader
- the group of theElement
- Returns:
- a new
CsvGenerator.Builder
-
entityGroup
public CsvGenerator.Builder entityGroup(String columnHeader)
Stores the group of anEntity
on a seperate column.- Parameters:
columnHeader
- the group of theEntity
- Returns:
- a new
CsvGenerator.Builder
-
edgeGroup
public CsvGenerator.Builder edgeGroup(String columnHeader)
Stores the group of anEdge
on a seperate column.- Parameters:
columnHeader
- the group of theEdge
- Returns:
- a new
CsvGenerator.Builder
-
property
public CsvGenerator.Builder property(String propertyName, String columnHeader)
Stores any additional properties of anElement
.
For example: property("count", "3").
This would add the "count" property with a value of "3"- Parameters:
propertyName
- the name of the propertycolumnHeader
- the value of the property- Returns:
- a new
CsvGenerator.Builder
-
vertex
public CsvGenerator.Builder vertex(String columnHeader)
Stores the Vertex of anEntity
- Parameters:
columnHeader
- the vertex contained within theEntity
- Returns:
- a new
CsvGenerator.Builder
-
source
public CsvGenerator.Builder source(String columnHeader)
Stores the Source Vertex of anEdge
.- Parameters:
columnHeader
- the source vertex- Returns:
- a new
CsvGenerator.Builder
-
destination
public CsvGenerator.Builder destination(String columnHeader)
Stores the Destination Vertex of anEntity
- Parameters:
columnHeader
- the destination vertex- Returns:
- a new
CsvGenerator.Builder
-
direction
public CsvGenerator.Builder direction(String columnHeader)
Stores the Direction flag, indicating whether or not theEdge
is directed.- Parameters:
columnHeader
- true or false for if theEdge
is directed or not- Returns:
- a new
CsvGenerator.Builder
-
identifier
public CsvGenerator.Builder identifier(IdentifierType identifierType, String columnHeader)
Allows anIdentifierType
of anElement
to be stored, such as anEdge
'sIdentifierType.MATCHED_VERTEX
.- Parameters:
identifierType
- theIdentifierType
of theElement
columnHeader
- the value for the corresponding field- Returns:
- a new
CsvGenerator.Builder
-
constant
public CsvGenerator.Builder constant(String key, String value)
Stores any constants specific to a givenElement
.- Parameters:
key
- the name of the constantvalue
- the value of the constant- Returns:
- a new
CsvGenerator.Builder
-
setAdditionalFieldsFromSchemaProperties
public CsvGenerator.Builder setAdditionalFieldsFromSchemaProperties(LinkedHashMap<String,Class<?>> schemaProperties)
Saves all properties from the schema which be added to fields.- Parameters:
schemaProperties
- the Map of property names to type- Returns:
- a new
CsvGenerator.Builder
-
commaReplacement
public CsvGenerator.Builder commaReplacement(String commaReplacement)
Stores the String with which any encountered commas will be replaced.- Parameters:
commaReplacement
- the replacement String- Returns:
- a new
CsvGenerator.Builder
-
quoted
public CsvGenerator.Builder quoted(boolean quoted)
Stores the flag for whether or not each distinct value should be wrapped in quotation marks.- Parameters:
quoted
- true or false- Returns:
- a new
CsvGenerator.Builder
-
build
public CsvGenerator build()
Passes all the configured fields and constants about anElement
to a newCsvGenerator
, including the comma replacement String, and the flag for whether values should be quoted.- Returns:
- a new
CsvGenerator
, containing all configured information
-
-