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 CsvGeneratorbuild()Passes all the configured fields and constants about anElementto a newCsvGenerator, including the comma replacement String, and the flag for whether values should be quoted.CsvGenerator.BuildercommaReplacement(String commaReplacement)Stores the String with which any encountered commas will be replaced.CsvGenerator.Builderconstant(String key, String value)Stores any constants specific to a givenElement.CsvGenerator.Builderdestination(String columnHeader)Stores the Destination Vertex of anEntityCsvGenerator.Builderdirection(String columnHeader)Stores the Direction flag, indicating whether or not theEdgeis directed.CsvGenerator.BuilderedgeGroup(String columnHeader)Stores the group of anEdgeon a seperate column.CsvGenerator.BuilderentityGroup(String columnHeader)Stores the group of anEntityon a seperate column.CsvGenerator.Buildergroup(String columnHeader)Stores the group of anElement.CsvGenerator.Builderidentifier(IdentifierType identifierType, String columnHeader)Allows anIdentifierTypeof anElementto be stored, such as anEdge'sIdentifierType.MATCHED_VERTEX.CsvGenerator.Builderproperty(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.Builderquoted(boolean quoted)Stores the flag for whether or not each distinct value should be wrapped in quotation marks.CsvGenerator.BuildersetAdditionalFieldsFromSchemaProperties(LinkedHashMap<String,Class<?>> schemaProperties)Saves all properties from the schema which be added to fields.CsvGenerator.Buildersource(String columnHeader)Stores the Source Vertex of anEdge.CsvGenerator.Buildervertex(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 anEntityon 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 anEdgeon 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 theEdgeis directed.- Parameters:
columnHeader- true or false for if theEdgeis directed or not- Returns:
- a new
CsvGenerator.Builder
-
identifier
public CsvGenerator.Builder identifier(IdentifierType identifierType, String columnHeader)
Allows anIdentifierTypeof anElementto be stored, such as anEdge'sIdentifierType.MATCHED_VERTEX.- Parameters:
identifierType- theIdentifierTypeof theElementcolumnHeader- 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 anElementto a newCsvGenerator, including the comma replacement String, and the flag for whether values should be quoted.- Returns:
- a new
CsvGenerator, containing all configured information
-
-