@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.Field
Field of a row.
|
static class |
Schema.FieldType
A descriptor of a single field 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 |
|---|---|
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() |
RowCoder |
getRowCoder()
Return the coder for a
Row with this schema. |
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) |
static java.util.stream.Collector<Schema.Field,java.util.List<Schema.Field>,Schema> |
toSchema()
Collects a stream of
Schema.Fields into a Schema. |
java.lang.String |
toString() |
public Schema(java.util.List<Schema.Field> fields)
public static Schema.Builder builder()
public static Schema of(Schema.Field... fields)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic boolean equivalent(Schema other)
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.util.List<Schema.Field> getFields()
public static java.util.stream.Collector<Schema.Field,java.util.List<Schema.Field>,Schema> toSchema()
Schema.Fields 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()