public class Schema extends Object
Constructor and Description |
---|
Schema(Iterable<Field> fields) |
Schema(Iterable<Field> fields,
Map<String,String> metadata)
Constructor with metadata.
|
Modifier and Type | Method and Description |
---|---|
static Schema |
convertSchema(Schema schema)
Converts a flatbuffer schema to its POJO representation.
|
static Schema |
deserialize(ByteBuffer buffer)
Deprecated.
|
static Schema |
deserializeMessage(ByteBuffer buffer)
Deserialize a schema that has been serialized as a message using
serializeAsMessage() . |
boolean |
equals(Object obj) |
static Field |
findField(List<Field> fields,
String name)
Search for a field by name in given the list of fields.
|
Field |
findField(String name)
Search for a field by name in this Schema.
|
static Schema |
fromJSON(String json) |
Map<String,String> |
getCustomMetadata() |
List<Field> |
getFields() |
int |
getSchema(com.google.flatbuffers.FlatBufferBuilder builder)
Adds this schema to the builder returning the size of the builder after adding.
|
int |
hashCode() |
byte[] |
serializeAsMessage()
Returns the serialized flatbuffer bytes of the schema wrapped in a message table.
|
byte[] |
toByteArray()
Deprecated.
This method does not encapsulate the schema in a Message payload which is incompatible with other
languages. Use
serializeAsMessage() instead. |
String |
toJson()
Returns the JSON string representation of this schema.
|
String |
toString() |
public static Field findField(List<Field> fields, String name)
fields
- the list of the fieldsname
- the name of the field to returnIllegalArgumentException
- if the field was not foundpublic static Schema fromJSON(String json) throws IOException
IOException
@Deprecated public static Schema deserialize(ByteBuffer buffer)
toByteArray()
.buffer
- the bytes to deserialize.public static Schema deserializeMessage(ByteBuffer buffer)
serializeAsMessage()
.buffer
- the bytes to deserialize.public static Schema convertSchema(Schema schema)
public Field findField(String name)
name
- the name of the field to returnIllegalArgumentException
- if the field was not foundpublic String toJson()
public int getSchema(com.google.flatbuffers.FlatBufferBuilder builder)
public byte[] serializeAsMessage()
to rebuild the Schema.
@Deprecated public byte[] toByteArray()
serializeAsMessage()
instead.Copyright © 2024 The Apache Software Foundation. All rights reserved.