@Experimental(value=SCHEMAS) public class OneOfType extends java.lang.Object implements Schema.LogicalType<OneOfType.Value,Row>
EnumerationType
logical type field that indicates which field is set.Modifier and Type | Class and Description |
---|---|
static class |
OneOfType.Value
Represents a single OneOf value.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IDENTIFIER |
Modifier and Type | Method and Description |
---|---|
static OneOfType |
create(java.util.List<Schema.Field> fields)
Create an
OneOfType logical type. |
static OneOfType |
create(java.util.List<Schema.Field> fields,
java.util.Map<java.lang.String,java.lang.Integer> enumValues)
Create an
OneOfType logical type. |
static OneOfType |
create(Schema.Field... fields)
Create an
OneOfType logical type. |
<T> OneOfType.Value |
createValue(EnumerationType.Value caseType,
T value)
Create a
OneOfType.Value specifying which field to set and the value to set. |
<T> OneOfType.Value |
createValue(int caseValue,
T value)
Create a
OneOfType.Value specifying which field to set and the value to set. |
<T> OneOfType.Value |
createValue(java.lang.String caseValue,
T value)
Create a
OneOfType.Value specifying which field to set and the value to set. |
byte[] |
getArgument()
An optional argument to configure the type.
|
Schema.FieldType |
getArgumentType()
A schema type representing how to interpret the argument.
|
Schema.FieldType |
getBaseType()
The base
Schema.FieldType used to store values of this type. |
EnumerationType |
getCaseEnumType()
Returns the
EnumerationType that is used to represent the case type. |
Schema.FieldType |
getFieldType(OneOfType.Value oneOneValue) |
java.lang.String |
getIdentifier()
The unique identifier for this type.
|
Schema |
getOneOfSchema()
Returns the schema of the underlying
Row that is used to represent the union. |
Row |
toBaseType(OneOfType.Value input)
Convert the input type to the type Java type used by the base
Schema.FieldType . |
OneOfType.Value |
toInputType(Row base)
Convert the Java type used by the base
Schema.FieldType to the input type. |
java.lang.String |
toString() |
public static final java.lang.String IDENTIFIER
public static OneOfType create(Schema.Field... fields)
OneOfType
logical type.public static OneOfType create(java.util.List<Schema.Field> fields)
OneOfType
logical type.public static OneOfType create(java.util.List<Schema.Field> fields, java.util.Map<java.lang.String,java.lang.Integer> enumValues)
OneOfType
logical type. This method allows control over the integer values in
the generated enum.public Schema getOneOfSchema()
Row
that is used to represent the union.public EnumerationType getCaseEnumType()
EnumerationType
that is used to represent the case type.public java.lang.String getIdentifier()
Schema.LogicalType
getIdentifier
in interface Schema.LogicalType<OneOfType.Value,Row>
public Schema.FieldType getArgumentType()
Schema.LogicalType
null
indicates this logical
type is not parameterized by an argument.getArgumentType
in interface Schema.LogicalType<OneOfType.Value,Row>
public byte[] getArgument()
Schema.LogicalType
getArgument
in interface Schema.LogicalType<OneOfType.Value,Row>
public Schema.FieldType getBaseType()
Schema.LogicalType
Schema.FieldType
used to store values of this type.getBaseType
in interface Schema.LogicalType<OneOfType.Value,Row>
public <T> OneOfType.Value createValue(java.lang.String caseValue, T value)
OneOfType.Value
specifying which field to set and the value to set.public <T> OneOfType.Value createValue(int caseValue, T value)
OneOfType.Value
specifying which field to set and the value to set.public <T> OneOfType.Value createValue(EnumerationType.Value caseType, T value)
OneOfType.Value
specifying which field to set and the value to set.public Schema.FieldType getFieldType(OneOfType.Value oneOneValue)
public Row toBaseType(OneOfType.Value input)
Schema.LogicalType
Schema.FieldType
.toBaseType
in interface Schema.LogicalType<OneOfType.Value,Row>
public OneOfType.Value toInputType(Row base)
Schema.LogicalType
Schema.FieldType
to the input type.toInputType
in interface Schema.LogicalType<OneOfType.Value,Row>
public java.lang.String toString()
toString
in class java.lang.Object