public class SpecificData extends GenericData
Modifier and Type | Class and Description |
---|---|
static interface |
SpecificData.SchemaConstructable
Tag interface that indicates that a class has a one-argument constructor
that accepts a Schema.
|
GenericData.Array<T>, GenericData.EnumSymbol, GenericData.Fixed, GenericData.Record, GenericData.StringType
Modifier and Type | Field and Description |
---|---|
static String |
CLASS_PROP |
static String |
ELEMENT_PROP |
static String |
KEY_CLASS_PROP |
protected Set<Class> |
stringableClasses
Read/write some common builtin classes as strings.
|
STRING_PROP, STRING_TYPE_STRING
Constructor and Description |
---|
SpecificData()
For subclasses.
|
SpecificData(ClassLoader classLoader)
Construct with a specific classloader.
|
Modifier and Type | Method and Description |
---|---|
protected int |
compare(Object o1,
Object o2,
Schema s,
boolean eq)
Comparison implementation.
|
DatumReader |
createDatumReader(Schema schema)
Returns a
DatumReader for this kind of data. |
DatumReader |
createDatumReader(Schema writer,
Schema reader)
Returns a
DatumReader for this kind of data. |
DatumWriter |
createDatumWriter(Schema schema)
Returns a
DatumWriter for this kind of data. |
Object |
createEnum(String symbol,
Schema schema)
Called to create an enum value.
|
Object |
createFixed(Object old,
Schema schema)
Called to create an fixed value.
|
protected Schema |
createSchema(Type type,
Map<String,Schema> names)
Create the schema for a Java type.
|
static SpecificData |
get()
Return the singleton instance.
|
Class |
getClass(Schema schema)
Return the class that implements a schema, or null if none exists.
|
static String |
getClassName(Schema schema)
Returns the Java class name indicated by a schema's name and namespace.
|
protected Schema |
getEnumSchema(Object datum)
Called to obtain the schema of a enum.
|
Protocol |
getProtocol(Class iface)
Return the protocol for a Java interface.
|
Schema |
getSchema(Type type)
Find the schema for a Java type.
|
protected String |
getSchemaName(Object datum)
Return the schema full name for a datum.
|
protected boolean |
isEnum(Object datum)
Called by the default implementation of
GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object) . |
protected boolean |
isStringable(Class<?> c)
True iff a class should be serialized with toString().
|
static Object |
newInstance(Class c,
Schema s)
Create an instance of a class.
|
Object |
newRecord(Object old,
Schema schema)
Called to create new record instances.
|
compare, createFixed, deepCopy, getClassLoader, getDefaultValue, getField, getField, getFixedSchema, getRecordSchema, getRecordState, hashCode, hashCodeAdd, induce, instanceOf, isArray, isBoolean, isBytes, isDouble, isFixed, isFloat, isInteger, isLong, isMap, isRecord, isString, resolveUnion, setField, setField, setStringType, toString, toString, validate
public static final String CLASS_PROP
public static final String KEY_CLASS_PROP
public static final String ELEMENT_PROP
protected Set<Class> stringableClasses
public SpecificData()
get()
.public SpecificData(ClassLoader classLoader)
public DatumReader createDatumReader(Schema schema)
GenericData
DatumReader
for this kind of data.createDatumReader
in class GenericData
public DatumReader createDatumReader(Schema writer, Schema reader)
GenericData
DatumReader
for this kind of data.createDatumReader
in class GenericData
public DatumWriter createDatumWriter(Schema schema)
GenericData
DatumWriter
for this kind of data.createDatumWriter
in class GenericData
public static SpecificData get()
protected boolean isEnum(Object datum)
GenericData
GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.isEnum
in class GenericData
public Object createEnum(String symbol, Schema schema)
GenericData
createEnum
in class GenericData
protected Schema getEnumSchema(Object datum)
GenericData
getEnumSchema
in class GenericData
public Class getClass(Schema schema)
public static String getClassName(Schema schema)
protected Schema createSchema(Type type, Map<String,Schema> names)
protected String getSchemaName(Object datum)
GenericData
GenericData.resolveUnion(Schema,Object)
.getSchemaName
in class GenericData
protected boolean isStringable(Class<?> c)
protected int compare(Object o1, Object o2, Schema s, boolean eq)
GenericData
compare
in class GenericData
public static Object newInstance(Class c, Schema s)
SpecificData.SchemaConstructable
, call a constructor with a Schema
parameter, otherwise use a no-arg constructor.public Object createFixed(Object old, Schema schema)
GenericData
GenericFixed
.createFixed
in class GenericData
public Object newRecord(Object old, Schema schema)
GenericData
GenericData.Record
.newRecord
in class GenericData
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.