org.apache.avro.specific
Class SpecificData

java.lang.Object
  extended by org.apache.avro.generic.GenericData
      extended by org.apache.avro.specific.SpecificData
Direct Known Subclasses:
ReflectData

public class SpecificData
extends GenericData

Utilities for generated Java classes and interfaces.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.avro.generic.GenericData
GenericData.Array<T>, GenericData.Fixed, GenericData.Record
 
Constructor Summary
protected SpecificData()
           
 
Method Summary
 int compare(Object o1, Object o2, Schema s)
          Compare objects according to their schema.
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.
 String getClassName(Schema schema)
          Returns the Java class name indicated by a schema's name and namespace.
 Protocol getProtocol(Class iface)
          Return the protocol for a Java interface.
protected  Schema getRecordSchema(Object record)
          Called to obtain the schema of a record.
 Schema getSchema(Type type)
          Find the 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 a Java datum matches a schema.
 
Methods inherited from class org.apache.avro.generic.GenericData
hashCode, hashCodeAdd, induce, instanceOf, isArray, isBytes, 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

SpecificData

protected SpecificData()
Method Detail

get

public static SpecificData get()
Return the singleton instance.


isRecord

protected boolean isRecord(Object datum)
Description copied from class: GenericData
Called by the default implementation of GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object).

Overrides:
isRecord in class GenericData

getRecordSchema

protected Schema getRecordSchema(Object record)
Description copied from class: GenericData
Called to obtain the schema of a record. By default calls {GenericContainer#getSchema(). May be overridden for alternate record representations.

Overrides:
getRecordSchema in class GenericData

isEnum

protected boolean isEnum(Object datum)
Description copied from class: GenericData
Called by the default implementation of GenericData.instanceOf(org.apache.avro.Schema, java.lang.Object).

Overrides:
isEnum in class GenericData

validate

public boolean validate(Schema schema,
                        Object datum)
Description copied from class: GenericData
Returns true if a Java datum matches a schema.

Overrides:
validate in class GenericData

getClass

public Class getClass(Schema schema)
Return the class that implements a schema.


getClassName

public String getClassName(Schema schema)
Returns the Java class name indicated by a schema's name and namespace.


getSchema

public Schema getSchema(Type type)
Find the schema for a Java type.


createSchema

protected Schema createSchema(Type type,
                              Map<String,Schema> names)
Create the schema for a Java type.


getProtocol

public Protocol getProtocol(Class iface)
Return the protocol for a Java interface.


compare

public int compare(Object o1,
                   Object o2,
                   Schema s)
Description copied from class: GenericData
Compare objects according to their schema. If equal, return zero. If greater-than, return 1, if less than return -1. Order is consistent with that of BinaryData.compare(byte[], int, byte[], int, Schema).

Overrides:
compare in class GenericData


Copyright © 2010 The Apache Software Foundation