public class Coerce extends SubAssembly
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.
SubAssembly
,
Identity
,
Serialized FormconfigDef, name, nodeConfigDef, parent, stepConfigDef
Constructor and Description |
---|
Coerce(Pipe previous,
java.lang.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,
java.lang.Class... types)
Constructor Coerce creates a new Coerce instance that will only coerce the given coerceFields Tuple values.
|
getName, getPrevious, getTailNames, getTails, setPrevious, setTails, unwind
equals, getConfigDef, getHeads, getNodeConfigDef, getParent, getStepConfigDef, getTrace, hasConfigDef, hashCode, hasNodeConfigDef, hasStepConfigDef, id, named, names, outgoingScopeFor, pipes, print, printInternal, resolveIncomingOperationArgumentFields, resolveIncomingOperationPassThroughFields, setParent, toString
@ConstructorProperties(value={"previous","types"}) public Coerce(Pipe previous, java.lang.Class... types)
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.
previous
- of type Pipetypes
- of type Class...@ConstructorProperties(value={"previous","coerceFields","types"}) public Coerce(Pipe previous, Fields coerceFields, java.lang.Class... types)
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.
previous
- of type PipecoerceFields
- of type Fieldstypes
- of type Class...@ConstructorProperties(value={"previous","coerceFields"}) public Coerce(Pipe previous, Fields coerceFields)
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.
previous
- of type PipecoerceFields
- of type FieldsCopyright © 2007-2017 Cascading Maintainers. All Rights Reserved.