@Experimental(value=SCHEMAS) public class Schema extends java.lang.Object implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Schema.Builder
Builder class for building
Schema objects. |
static class |
Schema.EquivalenceNullablePolicy
Control whether nullable is included in equivalence check.
|
static class |
Schema.Field
Field of a row.
|
static class |
Schema.FieldType
A descriptor of a single field type.
|
static interface |
Schema.LogicalType<InputT,BaseT>
A LogicalType allows users to define a custom schema type.
|
static class |
Schema.TypeName
An enumerated list of type constructors.
|
Constructor and Description |
---|
Schema(java.util.List<Schema.Field> fields) |
Modifier and Type | Method and Description |
---|---|
boolean |
assignableTo(Schema other)
Returns true if this Schema can be assigned to another Schema.
|
boolean |
assignableToIgnoreNullable(Schema other)
Returns true if this Schema can be assigned to another Schema, igmoring nullable.
|
static Schema.Builder |
builder() |
boolean |
equals(java.lang.Object o)
Returns true if two Schemas have the same fields in the same order.
|
boolean |
equivalent(Schema other)
Returns true if two Schemas have the same fields, but possibly in different orders.
|
Schema.Field |
getField(int index)
Return a field by index.
|
Schema.Field |
getField(java.lang.String name) |
int |
getFieldCount()
Return the count of fields.
|
java.util.List<java.lang.String> |
getFieldNames()
Return the list of all field names.
|
java.util.List<Schema.Field> |
getFields() |
java.util.UUID |
getUUID()
Get this schema's UUID.
|
boolean |
hasField(java.lang.String fieldName)
Returns true if
fieldName exists in the schema, false otherwise. |
int |
hashCode() |
int |
indexOf(java.lang.String fieldName)
Find the index of a given field.
|
java.lang.String |
nameOf(int fieldIndex)
Return the name of field by index.
|
static Schema |
of(Schema.Field... fields) |
void |
setUUID(java.util.UUID uuid)
Set this schema's UUID.
|
static java.util.stream.Collector<Schema.Field,java.util.List<Schema.Field>,Schema> |
toSchema()
Collects a stream of
Schema.Field s into a Schema . |
java.lang.String |
toString() |
boolean |
typesEqual(Schema other)
Returns true if two schemas are equal ignoring field names and descriptions.
|
public Schema(java.util.List<Schema.Field> fields)
public static Schema.Builder builder()
public static Schema of(Schema.Field... fields)
public void setUUID(java.util.UUID uuid)
@Nullable public java.util.UUID getUUID()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean typesEqual(Schema other)
public boolean equivalent(Schema other)
public boolean assignableTo(Schema other)
public boolean assignableToIgnoreNullable(Schema other)
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.List<Schema.Field> getFields()
public static java.util.stream.Collector<Schema.Field,java.util.List<Schema.Field>,Schema> toSchema()
Schema.Field
s into a Schema
.public java.util.List<java.lang.String> getFieldNames()
public Schema.Field getField(int index)
public Schema.Field getField(java.lang.String name)
public int indexOf(java.lang.String fieldName)
public boolean hasField(java.lang.String fieldName)
fieldName
exists in the schema, false otherwise.public java.lang.String nameOf(int fieldIndex)
public int getFieldCount()