FROM - the raw data to read from.TO - object to format the data into.@Beta public abstract class RecordFormat<FROM,TO> extends Object
| Constructor and Description |
|---|
RecordFormat() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(Map<String,String> settings)
Configure the format with the given properties.
|
protected abstract Schema |
getDefaultSchema()
Get the default schema for the format.
|
Schema |
getSchema()
Get the schema of the format.
|
void |
initialize(FormatSpecification formatSpecification)
Initialize the format with the given desired schema and properties.
|
abstract TO |
read(FROM input)
Read data from the input format to the output type.
|
protected abstract void |
validateSchema(Schema schema)
Validate the given schema, throwing an exception if it is unsupported.
|
protected Schema schema
public abstract TO read(FROM input) throws UnexpectedFormatException
input - input object to read.UnexpectedFormatException - if the input object could not be read because it is of an unexpected format.protected abstract Schema getDefaultSchema()
initialize(FormatSpecification). Should return null if there is no default schema, meaning
a schema must be provided during initialization of the format.protected abstract void validateSchema(Schema schema) throws UnsupportedTypeException
schema - the schema to validate for the formatUnsupportedTypeException - if the schema not supportedpublic void initialize(FormatSpecification formatSpecification) throws UnsupportedTypeException
formatSpecification - the specification for the format, containing the desired schema and settingsUnsupportedTypeException - if the desired schema and properties are not supportedprotected void configure(Map<String,String> settings)
read(Object) is made, and after a schema for the format has been set.settings - the settings to configure the format withpublic Schema getSchema()
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.