This project has retired. For details please refer to its Attic page.
AbstractCompositeExtractor (Apache Crunch 0.9.0 API)

org.apache.crunch.contrib.text
Class AbstractCompositeExtractor<T>

java.lang.Object
  extended by org.apache.crunch.contrib.text.AbstractCompositeExtractor<T>
All Implemented Interfaces:
Serializable, Extractor<T>

public abstract class AbstractCompositeExtractor<T>
extends Object
implements Extractor<T>

Base class for Extractor instances that delegates the parsing of fields to other Extractor instances, primarily used for constructing composite records that implement the Tuple interface.

See Also:
Serialized Form

Constructor Summary
AbstractCompositeExtractor(TokenizerFactory scannerFactory, List<Extractor<?>> extractors)
           
 
Method Summary
protected abstract  T doCreate(Object[] values)
          Subclasses should return a new instance of the object based on the fields parsed by the Extractor instances for this composite Extractor instance.
 boolean errorOnLastRecord()
          Returns true if the last call to extract on this instance threw an exception that was handled.
 T extract(String input)
          Extract a value with the type of this instance.
 ExtractorStats getStats()
          Return statistics about how many errors this Extractor instance encountered while parsing input data.
 void initialize()
          Perform any initialization required by this Extractor during the start of a map or reduce task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.crunch.contrib.text.Extractor
getDefaultValue, getPType
 

Constructor Detail

AbstractCompositeExtractor

public AbstractCompositeExtractor(TokenizerFactory scannerFactory,
                                  List<Extractor<?>> extractors)
Method Detail

extract

public T extract(String input)
Description copied from interface: Extractor
Extract a value with the type of this instance.

Specified by:
extract in interface Extractor<T>

initialize

public void initialize()
Description copied from interface: Extractor
Perform any initialization required by this Extractor during the start of a map or reduce task.

Specified by:
initialize in interface Extractor<T>

errorOnLastRecord

public boolean errorOnLastRecord()
Description copied from interface: Extractor
Returns true if the last call to extract on this instance threw an exception that was handled.

Specified by:
errorOnLastRecord in interface Extractor<T>

getStats

public ExtractorStats getStats()
Description copied from interface: Extractor
Return statistics about how many errors this Extractor instance encountered while parsing input data.

Specified by:
getStats in interface Extractor<T>

doCreate

protected abstract T doCreate(Object[] values)
Subclasses should return a new instance of the object based on the fields parsed by the Extractor instances for this composite Extractor instance.

Parameters:
values - The values that were extracted by the component Extractor objects
Returns:
A new instance of the composite class for this Extractor


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