com.cloudera.crunch.type.avro
Class AvroType<T>

java.lang.Object
  extended by com.cloudera.crunch.type.avro.AvroType<T>
All Implemented Interfaces:
PType<T>
Direct Known Subclasses:
AvroTableType

public class AvroType<T>
extends Object
implements PType<T>

The implementation of the PType interface for Avro-based serialization.


Constructor Summary
AvroType(Class<T> typeClass, org.apache.avro.Schema schema, MapFn inputMapFn, MapFn outputMapFn, PType... ptypes)
           
AvroType(Class<T> typeClass, org.apache.avro.Schema schema, PType... ptypes)
           
 
Method Summary
 boolean equals(Object other)
           
 Converter getConverter()
           
 SourceTarget<T> getDefaultFileSource(org.apache.hadoop.fs.Path path)
          Returns a SourceTarget that is able to read/write data using the serialization format specified by this PType.
 PTypeFamily getFamily()
          Returns the PTypeFamily that this PType belongs to.
 MapFn<Object,T> getInputMapFn()
           
 MapFn<T,Object> getOutputMapFn()
           
 org.apache.avro.Schema getSchema()
           
 List<PType> getSubTypes()
          Returns the sub-types that make up this PType if it is a composite instance, such as a tuple.
 Class<T> getTypeClass()
          Returns the Java type represented by this PType.
 int hashCode()
           
 boolean isSpecific()
          Determine if the wrapped type is a specific or generic avro type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvroType

public AvroType(Class<T> typeClass,
                org.apache.avro.Schema schema,
                PType... ptypes)

AvroType

public AvroType(Class<T> typeClass,
                org.apache.avro.Schema schema,
                MapFn inputMapFn,
                MapFn outputMapFn,
                PType... ptypes)
Method Detail

getTypeClass

public Class<T> getTypeClass()
Description copied from interface: PType
Returns the Java type represented by this PType.

Specified by:
getTypeClass in interface PType<T>

getFamily

public PTypeFamily getFamily()
Description copied from interface: PType
Returns the PTypeFamily that this PType belongs to.

Specified by:
getFamily in interface PType<T>

getSubTypes

public List<PType> getSubTypes()
Description copied from interface: PType
Returns the sub-types that make up this PType if it is a composite instance, such as a tuple.

Specified by:
getSubTypes in interface PType<T>

getSchema

public org.apache.avro.Schema getSchema()

isSpecific

public boolean isSpecific()
Determine if the wrapped type is a specific or generic avro type.

Returns:
true if the wrapped type is a specific data type

getInputMapFn

public MapFn<Object,T> getInputMapFn()
Specified by:
getInputMapFn in interface PType<T>

getOutputMapFn

public MapFn<T,Object> getOutputMapFn()
Specified by:
getOutputMapFn in interface PType<T>

getConverter

public Converter getConverter()
Specified by:
getConverter in interface PType<T>

getDefaultFileSource

public SourceTarget<T> getDefaultFileSource(org.apache.hadoop.fs.Path path)
Description copied from interface: PType
Returns a SourceTarget that is able to read/write data using the serialization format specified by this PType.

Specified by:
getDefaultFileSource in interface PType<T>

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012. All Rights Reserved.