cascading.pipe.assembly
Class Coerce

java.lang.Object
  extended by cascading.pipe.Pipe
      extended by cascading.pipe.SubAssembly
          extended by cascading.pipe.assembly.Coerce
All Implemented Interfaces:
FlowElement, Traceable, Serializable

public class Coerce
extends SubAssembly

Class Coerce is a SubAssembly that will coerce all incoming Tuple values to the given types.

If the given type is a primitive (long), and the tuple value is null, 0 is returned. If the type is an Object (java.lang.Long), and the tuple value is null, null is returned.

Coerce encapsulates the Identity function.

Note if the resolved coerceFields size does not equal the number of given types there will be a runtime error during execution.

See Also:
SubAssembly, Identity, Serialized Form

Field Summary
 
Fields inherited from class cascading.pipe.Pipe
configDef, name, parent, stepConfigDef
 
Constructor Summary
Coerce(Pipe previous, Class... types)
          Constructor Coerce creates a new Coerce instance that will coerce all input Tuple values.
Coerce(Pipe previous, Fields coerceFields)
          Constructor Coerce creates a new Coerce instance that will only coerce the given coerceFields Tuple values.
Coerce(Pipe previous, Fields coerceFields, Class... types)
          Constructor Coerce creates a new Coerce instance that will only coerce the given coerceFields Tuple values.
 
Method Summary
 
Methods inherited from class cascading.pipe.SubAssembly
getName, getPrevious, getTailNames, getTails, setPrevious, setTails, unwind
 
Methods inherited from class cascading.pipe.Pipe
equals, getConfigDef, getHeads, getParent, getStepConfigDef, getTrace, hasConfigDef, hashCode, hasStepConfigDef, id, isEquivalentTo, named, names, outgoingScopeFor, pipes, print, printInternal, resolveIncomingOperationArgumentFields, resolveIncomingOperationPassThroughFields, setParent, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coerce

@ConstructorProperties(value={"previous","types"})
public Coerce(Pipe previous,
                                         Class... types)
Constructor Coerce creates a new Coerce instance that will coerce all input Tuple values.

Note if the resolved coerceFields size does not equal the number of given types there will be a runtime error during execution. Declaring the fields that must be coerced is a suggested practice.

Parameters:
previous - of type Pipe
types - of type Class...

Coerce

@ConstructorProperties(value={"previous","coerceFields","types"})
public Coerce(Pipe previous,
                                         Fields coerceFields,
                                         Class... types)
Constructor Coerce creates a new Coerce instance that will only coerce the given coerceFields Tuple values.

Note the resulting output Tuple will contain all the original incoming Fields.

Also note if the resolved coerceFields size does not equal the number of given types there will be a runtime error during execution.

Parameters:
previous - of type Pipe
coerceFields - of type Fields
types - of type Class...

Coerce

@ConstructorProperties(value={"previous","coerceFields"})
public Coerce(Pipe previous,
                                         Fields coerceFields)
Constructor Coerce creates a new Coerce instance that will only coerce the given coerceFields Tuple values.

The given coerceFields instance must contain field type information, otherwise an IllegalArgumentException will be thrown.

Note the resulting output Tuple will contain all the original incoming Fields.

Parameters:
previous - of type Pipe
coerceFields - of type Fields


Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.