|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kitesdk.data.DatasetDescriptor.Builder
public static class DatasetDescriptor.Builder
A fluent builder to aid in the construction of DatasetDescriptor
s.
Constructor Summary | |
---|---|
DatasetDescriptor.Builder()
|
|
DatasetDescriptor.Builder(DatasetDescriptor descriptor)
Creates a Builder configured to copy descriptor , if it is not
modified. |
Method Summary | ||
---|---|---|
DatasetDescriptor |
build()
Build an instance of the configured dataset descriptor. |
|
DatasetDescriptor.Builder |
columnMapping(ColumnMapping columnMappings)
Configure the dataset's column mapping descriptor (optional) |
|
DatasetDescriptor.Builder |
columnMapping(File file)
Configure the dataset's column mapping descriptor from a File. |
|
DatasetDescriptor.Builder |
columnMapping(InputStream in)
Configure the dataset's column mapping descriptor from an InputStream. |
|
DatasetDescriptor.Builder |
columnMappingLiteral(String literal)
Configure the dataset's column mappings from a String literal. |
|
DatasetDescriptor.Builder |
columnMappingUri(String uri)
Configure the dataset's column mappings from a String URI. |
|
DatasetDescriptor.Builder |
columnMappingUri(URI uri)
Configure the dataset's column mappings from a URI. |
|
DatasetDescriptor.Builder |
format(Format format)
Configure the dataset's format (optional). |
|
DatasetDescriptor.Builder |
format(String formatName)
Configure the dataset's format from a format name String (optional). |
|
DatasetDescriptor.Builder |
location(Path uri)
Configure the dataset's location (optional). |
|
DatasetDescriptor.Builder |
location(String uri)
Configure the dataset's location (optional). |
|
DatasetDescriptor.Builder |
location(URI uri)
Configure the dataset's location (optional). |
|
DatasetDescriptor.Builder |
partitionStrategy(File file)
Configure the dataset's partition strategy from a File. |
|
DatasetDescriptor.Builder |
partitionStrategy(InputStream in)
Configure the dataset's partition strategy from an InputStream. |
|
DatasetDescriptor.Builder |
partitionStrategy(PartitionStrategy partitionStrategy)
Configure the dataset's partitioning strategy (optional). |
|
DatasetDescriptor.Builder |
partitionStrategyLiteral(String literal)
Configure the dataset's partition strategy from a String literal. |
|
DatasetDescriptor.Builder |
partitionStrategyUri(String uri)
Configure the dataset's partition strategy from a String URI. |
|
DatasetDescriptor.Builder |
partitionStrategyUri(URI uri)
Configure the dataset's partition strategy from a URI. |
|
DatasetDescriptor.Builder |
property(String name,
String value)
Add a key-value property to the descriptor. |
|
|
schema(Class<T> type)
Configure the dataset's schema via a Java class type. |
|
DatasetDescriptor.Builder |
schema(File file)
Configure the dataset's schema from a File . |
|
DatasetDescriptor.Builder |
schema(InputStream in)
Configure the dataset's schema from an InputStream . |
|
DatasetDescriptor.Builder |
schema(Schema schema)
Configure the dataset's schema. |
|
DatasetDescriptor.Builder |
schemaFromAvroDataFile(File file)
Configure the dataset's schema by using the schema from an existing Avro data file. |
|
DatasetDescriptor.Builder |
schemaFromAvroDataFile(InputStream in)
Configure the dataset's schema by using the schema from an existing Avro data file. |
|
DatasetDescriptor.Builder |
schemaFromAvroDataFile(URI uri)
Configure the dataset's schema by using the schema from an existing Avro data file. |
|
DatasetDescriptor.Builder |
schemaLiteral(String s)
Configure the dataset's schema from a String . |
|
DatasetDescriptor.Builder |
schemaUri(String uri)
Configure the Dataset 's schema from a String URI. |
|
DatasetDescriptor.Builder |
schemaUri(URI uri)
Configure the Dataset 's schema from a URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DatasetDescriptor.Builder()
public DatasetDescriptor.Builder(DatasetDescriptor descriptor)
descriptor
, if it is not
modified. This is intended to help callers copy and update descriptors
even though they are Immutable
.
descriptor
- A DatasetDescriptor
to copy settings fromMethod Detail |
---|
public DatasetDescriptor.Builder schema(Schema schema)
schema
, schemaLiteral
,
schemaUri
, or schemaFromAvroDataFile
.
public DatasetDescriptor.Builder schema(File file) throws IOException
File
. A schema is required,
and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
IOException
public DatasetDescriptor.Builder schema(InputStream in) throws IOException
InputStream
. It is the
caller's responsibility to close the InputStream
. A schema is
required, and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
IOException
public DatasetDescriptor.Builder schemaUri(URI uri) throws IOException
Dataset
's schema from a URI. A schema is required,
and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
uri
- a URI object for the schema's location.
MalformedURLException
- if uri
is not a valid URL
IOException
public DatasetDescriptor.Builder schemaUri(String uri) throws URISyntaxException, IOException
Dataset
's schema from a String URI. A schema is
required, and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
uri
- a String URI
URISyntaxException
- if uri
is not a valid URI
MalformedURLException
- if uri
is not a valid URL
IOException
public DatasetDescriptor.Builder schemaLiteral(String s)
String
. A schema is
required, and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
public <T> DatasetDescriptor.Builder schema(Class<T> type)
schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
public DatasetDescriptor.Builder schemaFromAvroDataFile(File file) throws IOException
schema
, schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
IOException
public DatasetDescriptor.Builder schemaFromAvroDataFile(InputStream in) throws IOException
InputStream
. A schema is required, and can be set using one of
the methods schema
, schemaLiteral
, schemaUri
,
or schemaFromAvroDataFile
.
IOException
public DatasetDescriptor.Builder schemaFromAvroDataFile(URI uri) throws IOException
schema
, schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.
IOException
public DatasetDescriptor.Builder format(Format format)
Formats.AVRO
is used by default.
public DatasetDescriptor.Builder format(String formatName)
Formats.AVRO
is used by default.
formatName
- a String format name
UnknownFormatException
- if the format name is not recognized.public DatasetDescriptor.Builder location(@Nullable URI uri)
uri
- A URI location
public DatasetDescriptor.Builder location(Path uri)
uri
- A location Path
public DatasetDescriptor.Builder location(String uri) throws URISyntaxException
uri
- A location String URI
URISyntaxException
- if uri
is not a valid URIpublic DatasetDescriptor.Builder property(String name, String value)
name
- the property namevalue
- the property value
public DatasetDescriptor.Builder partitionStrategy(@Nullable PartitionStrategy partitionStrategy)
public DatasetDescriptor.Builder partitionStrategy(File file)
PartitionStrategy.toString()
.
file
- The File
ValidationException
- If the file does not contain a valid JSON-encoded partition
strategy
DatasetIOException
- If there is an IOException accessing the file contentspublic DatasetDescriptor.Builder partitionStrategy(InputStream in)
PartitionStrategy.toString()
.
in
- The input stream
ValidationException
- If the stream does not contain a valid JSON-encoded partition
strategy
DatasetIOException
- If there is an IOException accessing the InputStream contentspublic DatasetDescriptor.Builder partitionStrategyLiteral(String literal)
PartitionStrategy.toString()
.
literal
- A partition strategy String literal
ValidationException
- If the literal is not a valid JSON-encoded partition strategypublic DatasetDescriptor.Builder partitionStrategyUri(URI uri) throws IOException
uri
- A URI to a partition strategy JSON file.
ValidationException
- If the literal is not a valid JSON-encoded partition strategy
IOException
public DatasetDescriptor.Builder partitionStrategyUri(String uri) throws URISyntaxException, IOException
uri
- A String URI to a partition strategy JSON file.
ValidationException
- If the literal is not a valid JSON-encoded partition strategy
URISyntaxException
- if uri
is not a valid URI
IOException
public DatasetDescriptor.Builder columnMapping(@Nullable ColumnMapping columnMappings)
columnMappings
- A ColumnMapping
public DatasetDescriptor.Builder columnMapping(File file)
ColumnMapping.toString()
.
file
- The file
ValidationException
- If the literal is not valid JSON-encoded column mappings
DatasetIOException
- If there is an IOException accessing the file contentspublic DatasetDescriptor.Builder columnMapping(InputStream in)
ColumnMapping.toString()
.
in
- The input stream
ValidationException
- If the literal is not valid JSON-encoded column mappings
DatasetIOException
- If there is an IOException accessing the InputStream contentspublic DatasetDescriptor.Builder columnMappingLiteral(String literal)
ColumnMapping.toString()
.
literal
- A column mapping String literal
ValidationException
- If the literal is not valid JSON-encoded column mappingspublic DatasetDescriptor.Builder columnMappingUri(URI uri) throws IOException
uri
- A URI to a column mapping JSON file
ValidationException
- If the literal is not valid JSON-encoded column mappings
IOException
- If accessing the URI results in an IOExceptionpublic DatasetDescriptor.Builder columnMappingUri(String uri) throws URISyntaxException, IOException
uri
- A String URI to a column mapping JSON file
ValidationException
- If the literal is not valid JSON-encoded column mappings
IOException
- If accessing the URI results in an IOException
URISyntaxException
- If uri
is not a valid URIpublic DatasetDescriptor build()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |