@Experimental(value=SCHEMAS) public class EnumerationType extends java.lang.Object implements Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
Schema.LogicalType
represent an enumeration over a fixed set of values.Modifier and Type | Class and Description |
---|---|
static class |
EnumerationType.Value
This class represents a single enum value.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IDENTIFIER |
Modifier and Type | Method and Description |
---|---|
static EnumerationType |
create(java.util.List<java.lang.String> enumValues)
Create an enumeration type from a fixed set of String values; integer values will be
automatically chosen.
|
static EnumerationType |
create(java.util.Map<java.lang.String,java.lang.Integer> enumValues)
Create an enumeration type over a set of String->Integer values.
|
static EnumerationType |
create(java.lang.String... enumValues)
Create an enumeration type from a fixed set of String values; integer values will be
automatically chosen.
|
java.util.Map<java.lang.String,java.lang.Integer> |
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. |
java.lang.String |
getIdentifier()
The unique identifier for this type.
|
java.util.List<java.lang.String> |
getValues() |
java.util.Map<java.lang.String,java.lang.Integer> |
getValuesMap() |
java.lang.Integer |
toBaseType(EnumerationType.Value input) |
EnumerationType.Value |
toInputType(java.lang.Integer base)
Convert the Java type used by the base
Schema.FieldType to the input type. |
java.lang.String |
toString() |
java.lang.String |
toString(EnumerationType.Value value) |
EnumerationType.Value |
valueOf(int value)
Return an
EnumerationType.Value corresponding to one of the enumeration integer values. |
EnumerationType.Value |
valueOf(java.lang.String stringValue)
Return an
EnumerationType.Value corresponding to one of the enumeration strings. |
public static final java.lang.String IDENTIFIER
public static EnumerationType create(java.util.Map<java.lang.String,java.lang.Integer> enumValues)
public static EnumerationType create(java.util.List<java.lang.String> enumValues)
public static EnumerationType create(java.lang.String... enumValues)
public EnumerationType.Value valueOf(java.lang.String stringValue)
EnumerationType.Value
corresponding to one of the enumeration strings.public EnumerationType.Value valueOf(int value)
EnumerationType.Value
corresponding to one of the enumeration integer values.public java.lang.String getIdentifier()
Schema.LogicalType
getIdentifier
in interface Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
public Schema.FieldType getArgumentType()
Schema.LogicalType
getArgumentType
in interface Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
public java.util.Map<java.lang.String,java.lang.Integer> getArgument()
Schema.LogicalType
getArgument
in interface Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
public Schema.FieldType getBaseType()
Schema.LogicalType
Schema.FieldType
used to store values of this type.getBaseType
in interface Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
public java.lang.Integer toBaseType(EnumerationType.Value input)
toBaseType
in interface Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
public EnumerationType.Value toInputType(java.lang.Integer base)
Schema.LogicalType
Schema.FieldType
to the input type.toInputType
in interface Schema.LogicalType<EnumerationType.Value,java.lang.Integer>
public java.util.Map<java.lang.String,java.lang.Integer> getValuesMap()
public java.util.List<java.lang.String> getValues()
public java.lang.String toString(EnumerationType.Value value)
public java.lang.String toString()
toString
in class java.lang.Object