|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.avro.generic.GenericData
org.apache.avro.specific.SpecificData
org.apache.avro.reflect.ReflectData
public class ReflectData
Utilities to use existing Java classes and interfaces via reflection.
| Nested Class Summary | |
|---|---|
static class |
ReflectData.AllowNull
ReflectData implementation that permits null field values. |
| Nested classes/interfaces inherited from class org.apache.avro.generic.GenericData |
|---|
GenericData.Array<T>, GenericData.EnumSymbol, GenericData.Fixed, GenericData.Record |
| Constructor Summary | |
|---|---|
protected |
ReflectData()
|
| Method Summary | |
|---|---|
int |
compare(Object o1,
Object o2,
Schema s)
Compare objects according to their schema. |
protected Schema |
createFieldSchema(Field field,
Map<String,Schema> names)
Create a schema for a field. |
protected Schema |
createSchema(Type type,
Map<String,Schema> names)
Create the schema for a Java type. |
static ReflectData |
get()
Return the singleton instance. |
Class |
getClass(Schema schema)
Return the class that implements a schema, or null if none exists. |
Object |
getField(Object record,
String name,
int position)
Called by GenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to retrieve a record
field value from a reused instance. |
Protocol |
getProtocol(Class iface)
Return the protocol for a Java interface. |
protected Schema |
getRecordSchema(Object record)
Called to obtain the schema of a record. |
protected boolean |
isArray(Object datum)
Called by the default implementation of GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object). |
protected boolean |
isBytes(Object datum)
Called by the default implementation of GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object). |
protected boolean |
isRecord(Object datum)
Called by the default implementation of GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object). |
static Schema |
makeNullable(Schema schema)
Create and return a union of the null schema and the provided schema. |
void |
setField(Object record,
String name,
int position,
Object o)
Called by GenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to set a record fields
value to a record instance. |
boolean |
validate(Schema schema,
Object datum)
Returns true if a Java datum matches a schema. |
| Methods inherited from class org.apache.avro.specific.SpecificData |
|---|
getClassName, getEnumSchema, getSchema, isEnum |
| Methods inherited from class org.apache.avro.generic.GenericData |
|---|
getFixedSchema, hashCode, hashCodeAdd, induce, instanceOf, isFixed, isMap, isString, resolveUnion, toString, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ReflectData()
| Method Detail |
|---|
public static ReflectData get()
public void setField(Object record,
String name,
int position,
Object o)
GenericDataGenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to set a record fields
value to a record instance. The default implementation is for IndexedRecord.
setField in class GenericData
public Object getField(Object record,
String name,
int position)
GenericDataGenericDatumReader.readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to retrieve a record
field value from a reused instance. The default implementation is for
IndexedRecord.
getField in class GenericDataprotected boolean isRecord(Object datum)
GenericDataGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object).
isRecord in class GenericDataprotected boolean isArray(Object datum)
GenericDataGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object).
isArray in class GenericDataprotected boolean isBytes(Object datum)
GenericDataGenericData.instanceOf(org.apache.avro.Schema, java.lang.Object).
isBytes in class GenericDataprotected Schema getRecordSchema(Object record)
GenericData
getRecordSchema in class GenericData
public boolean validate(Schema schema,
Object datum)
GenericData
validate in class GenericDatapublic Class getClass(Schema schema)
SpecificData
getClass in class SpecificData
protected Schema createSchema(Type type,
Map<String,Schema> names)
SpecificData
createSchema in class SpecificDatapublic static Schema makeNullable(Schema schema)
protected Schema createFieldSchema(Field field,
Map<String,Schema> names)
public Protocol getProtocol(Class iface)
Note that this requires that Paranamer is run over compiled interface declarations, since Java 6 reflection does not provide access to method parameter names. See Avro's build.xml for an example.
getProtocol in class SpecificData
public int compare(Object o1,
Object o2,
Schema s)
GenericDataBinaryData.compare(byte[], int, byte[], int, Schema).
compare in class SpecificData
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||