public class SpecificData extends GenericData
| Modifier and Type | Class and Description | 
|---|---|
| static interface  | SpecificData.SchemaConstructableTag interface that indicates that a class has a one-argument constructor that
 accepts a Schema. | 
GenericData.Array<T>, GenericData.EnumSymbol, GenericData.Fixed, GenericData.InstanceSupplier, GenericData.Record, GenericData.StringType| Modifier and Type | Field and Description | 
|---|---|
| static String | CLASS_PROP | 
| static String | ELEMENT_PROP | 
| static String | KEY_CLASS_PROP | 
| static Set<String> | RESERVED_WORDSList of Java reserved words from
 https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.9 combined
 with the boolean and null literals. | 
| protected Set<Class> | stringableClassesRead/write some common builtin classes as strings. | 
FAST_READER_PROP, 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  DatumReaderfor this kind of data. | 
| DatumReader | createDatumReader(Schema writer,
                 Schema reader)Returns a  DatumReaderfor this kind of data. | 
| DatumWriter | createDatumWriter(Schema schema)Returns a  DatumWriterfor 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. | 
| Object | createString(Object value)Called to create an string value. | 
| 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. | 
| static BinaryDecoder | getDecoder(ObjectInput in)Runtime utility used by generated classes. | 
| static BinaryEncoder | getEncoder(ObjectOutput out)Runtime utility used by generated classes. | 
| protected Schema | getEnumSchema(Object datum)Called to obtain the schema of a enum. | 
| static <T> SpecificData | getForClass(Class<T> c)If the given class is assignable to  SpecificRecordBase, this method
 returns the SpecificData instance from the fieldMODEL$, in order to
 get the correctConversioninstances for the class. | 
| static SpecificData | getForSchema(Schema reader)For RECORD type schemas, this method returns the SpecificData instance of the
 class associated with the schema, in order to get the right conversions for
 any logical types used. | 
| GenericData.InstanceSupplier | getNewRecordSupplier(Schema schema)create a supplier that allows to get new record instances for a given schema
 in an optimized way | 
| 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 if a class should be serialized with toString(). | 
| protected boolean | isStringType(Class<?> c)True if a class IS a string type | 
| 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. | 
| void | setCustomCoders(boolean flag)Dynamically set the value of the custom-coder feature flag. | 
| boolean | useCustomCoders()Retrieve the current value of the custom-coders feature flag. | 
addLogicalTypeConversion, compare, createFixed, deepCopy, getArrayAsCollection, getClassLoader, getConversionByClass, getConversionByClass, getConversionFor, getConversions, getDefaultValue, getFastReaderBuilder, getField, getField, getFixedSchema, getRecordSchema, getRecordState, hashCode, hashCodeAdd, induce, instanceOf, isArray, isBoolean, isBytes, isDouble, isFastReaderEnabled, isFixed, isFloat, isInteger, isLong, isMap, isRecord, isString, newArray, newMap, resolveUnion, setFastReaderEnabled, setField, setField, setStringType, toString, toString, validatepublic static final String CLASS_PROP
public static final String KEY_CLASS_PROP
public static final String ELEMENT_PROP
public static final Set<String> RESERVED_WORDS
protected Set<Class> stringableClasses
public SpecificData()
get().public SpecificData(ClassLoader classLoader)
public DatumReader createDatumReader(Schema schema)
GenericDataDatumReader for this kind of data.createDatumReader in class GenericDatapublic DatumReader createDatumReader(Schema writer, Schema reader)
GenericDataDatumReader for this kind of data.createDatumReader in class GenericDatapublic DatumWriter createDatumWriter(Schema schema)
GenericDataDatumWriter for this kind of data.createDatumWriter in class GenericDatapublic static SpecificData get()
public static SpecificData getForSchema(Schema reader)
reader - the reader schemapublic static <T> SpecificData getForClass(Class<T> c)
SpecificRecordBase, this method
 returns the SpecificData instance from the field MODEL$, in order to
 get the correct Conversion instances for the class.
 Falls back to the default instance get() for other
 classes or if the field is not found.T - .c - A classpublic boolean useCustomCoders()
true, but this default can be overriden using the system
 property org.apache.avro.specific.use_custom_coders, and can be
 set dynamically by useCustomCoders(). See  for more about this feature flag.public void setCustomCoders(boolean flag)
useCustomCoders().protected boolean isEnum(Object datum)
GenericDataGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object).isEnum in class GenericDatapublic Object createEnum(String symbol, Schema schema)
GenericDatacreateEnum in class GenericDataprotected Schema getEnumSchema(Object datum)
GenericDatagetEnumSchema in class GenericDatapublic Class getClass(Schema schema)
public static String getClassName(Schema schema)
protected Schema createSchema(Type type, Map<String,Schema> names)
protected String getSchemaName(Object datum)
GenericDataGenericData.resolveUnion(Schema,Object).getSchemaName in class GenericDataprotected boolean isStringable(Class<?> c)
protected boolean isStringType(Class<?> c)
protected int compare(Object o1, Object o2, Schema s, boolean eq)
GenericDatacompare in class GenericDatapublic 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)
GenericDataGenericFixed.createFixed in class GenericDatapublic Object newRecord(Object old, Schema schema)
GenericDataGenericData.Record.newRecord in class GenericDatapublic GenericData.InstanceSupplier getNewRecordSupplier(Schema schema)
GenericDatagetNewRecordSupplier in class GenericDatapublic static BinaryDecoder getDecoder(ObjectInput in)
public static BinaryEncoder getEncoder(ObjectOutput out)
public Object createString(Object value)
GenericDatacreateString in class GenericDataCopyright © 2009–2020 The Apache Software Foundation. All rights reserved.