org.apache.crunch.types.writable
Class WritableType<T,W extends org.apache.hadoop.io.Writable>

java.lang.Object
  extended by org.apache.crunch.types.writable.WritableType<T,W>
All Implemented Interfaces:
Serializable, PType<T>

public class WritableType<T,W extends org.apache.hadoop.io.Writable>
extends Object
implements PType<T>

See Also:
Serialized Form

Method Summary
 boolean equals(Object obj)
           
 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.
 T getDetachedValue(T value)
          Returns a copy of a value (or the value itself) that can safely be retained.
 PTypeFamily getFamily()
          Returns the PTypeFamily that this PType belongs to.
 MapFn getInputMapFn()
           
 MapFn getOutputMapFn()
           
 Class<W> getSerializationClass()
           
 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()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFamily

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

Specified by:
getFamily in interface PType<T>

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>

getConverter

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

getInputMapFn

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

getOutputMapFn

public MapFn getOutputMapFn()
Specified by:
getOutputMapFn 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>

getSerializationClass

public Class<W> getSerializationClass()

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 obj)
Overrides:
equals in class Object

getDetachedValue

public T getDetachedValue(T value)
Description copied from interface: PType
Returns a copy of a value (or the value itself) that can safely be retained.

This is useful when iterable values being processed in a DoFn (via a reducer) need to be held on to for more than the scope of a single iteration, as a reducer (and therefore also a DoFn that has an Iterable as input) re-use deserialized values. More information on object reuse is available in the DoFn class documentation.

Specified by:
getDetachedValue in interface PType<T>
Parameters:
value - The value to be deep-copied
Returns:
A deep copy of the input value

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.