|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avro.generic.GenericData 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.Fixed, GenericData.Record |
Constructor Summary | |
---|---|
protected |
ReflectData()
|
Method Summary | |
---|---|
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 a schema for a type and it's fields. |
static ReflectData |
get()
Return the singleton instance. |
Protocol |
getProtocol(Class iface)
Generate a protocol for a Java interface. |
protected Schema |
getRecordSchema(Object record)
Called to obtain the schema of a record. |
Schema |
getSchema(Type type)
Generate a schema for a Java type. |
protected boolean |
isEnum(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) . |
boolean |
validate(Schema schema,
Object datum)
Returns true if an object matches a schema. |
Methods inherited from class org.apache.avro.generic.GenericData |
---|
compare, induce, instanceOf, isArray, isBytes, isFixed, isMap, isString, resolveUnion, 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()
protected boolean isRecord(Object datum)
GenericData
GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.
isRecord
in class GenericData
protected Schema getRecordSchema(Object record)
GenericData
getRecordSchema
in class GenericData
protected boolean isEnum(Object datum)
GenericData
GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object)
.
isEnum
in class GenericData
public boolean validate(Schema schema, Object datum)
validate
in class GenericData
public Schema getSchema(Type type)
For records, declared fields
(not
inherited) which are not static or transient are used.
Note that unions cannot be automatically generated by this method, since Java provides no representation for unions.
protected Schema createSchema(Type type, Map<String,Schema> names)
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |