|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avro.Schema
public abstract class Schema
An abstract data type.
A schema may be one of:
Nested Class Summary | |
---|---|
static class |
Schema.Field
A field within a record. |
static class |
Schema.Type
The type of a schema. |
Method Summary | |
---|---|
static Schema |
create(Schema.Type type)
Create a schema for a primitive type. |
static Schema |
createArray(Schema elementType)
Create an array schema. |
static Schema |
createEnum(String name,
String namespace,
List<String> values)
Create an enum schema. |
static Schema |
createFixed(String name,
String space,
int size)
Create a union schema. |
static Schema |
createMap(Schema valueType)
Create a map schema. |
static Schema |
createRecord(LinkedHashMap<String,Schema.Field> fields)
Create an anonymous record schema. |
static Schema |
createRecord(String name,
String namespace,
boolean isError)
Create a named record schema. |
static Schema |
createUnion(List<Schema> types)
Create a union schema. |
boolean |
equals(Object o)
|
Schema |
getElementType()
If this is an array, returns its element type. |
int |
getEnumOrdinal(String symbol)
If this is an enum, return a symbol's ordinal value. |
List<String> |
getEnumSymbols()
If this is an enum, return its symbols. |
Map<String,Schema.Field> |
getFields()
If this is a record, returns its fields. |
Iterable<Map.Entry<String,Schema>> |
getFieldSchemas()
If this is a record, enumerate its field names and their schemas. |
int |
getFixedSize()
If this is fixed, returns its size. |
String |
getName()
If this is a record, enum or fixed, returns its name, otherwise the name of the primitive type. |
String |
getNamespace()
If this is a record, enum or fixed, returns its namespace, if any. |
Schema.Type |
getType()
Return the type of this schema. |
List<Schema> |
getTypes()
If this is a union, returns its types. |
Schema |
getValueType()
If this is a map, returns its value type. |
int |
hashCode()
|
boolean |
isError()
Returns true if this record is an error type. |
static Schema |
parse(File file)
|
static Schema |
parse(String jsonSchema)
Construct a schema from JSON text. |
void |
setFields(LinkedHashMap<String,Schema.Field> fields)
If this is a record, set its fields. |
String |
toString()
Render this as JSON. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Schema create(Schema.Type type)
public static Schema createRecord(LinkedHashMap<String,Schema.Field> fields)
public static Schema createRecord(String name, String namespace, boolean isError)
public static Schema createEnum(String name, String namespace, List<String> values)
public static Schema createArray(Schema elementType)
public static Schema createMap(Schema valueType)
public static Schema createUnion(List<Schema> types)
public static Schema createFixed(String name, String space, int size)
public Schema.Type getType()
public Map<String,Schema.Field> getFields()
public Iterable<Map.Entry<String,Schema>> getFieldSchemas()
public void setFields(LinkedHashMap<String,Schema.Field> fields)
public List<String> getEnumSymbols()
public int getEnumOrdinal(String symbol)
public String getName()
public String getNamespace()
public boolean isError()
public Schema getElementType()
public Schema getValueType()
public List<Schema> getTypes()
public int getFixedSize()
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public static Schema parse(File file) throws IOException
IOException
public static Schema parse(String jsonSchema)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |