cascading.tuple.type
Interface CoercibleType<Canonical>
- All Superinterfaces:
- Serializable, Type
- All Known Implementing Classes:
- BigDecimalCoerce, BooleanCoerce, BooleanObjectCoerce, CharacterCoerce, CharacterObjectCoerce, Coercions.Coerce, DateType, DoubleCoerce, DoubleObjectCoerce, FloatCoerce, FloatObjectCoerce, IntegerCoerce, IntegerObjectCoerce, LongCoerce, LongObjectCoerce, ObjectCoerce, ShortCoerce, ShortObjectCoerce, StringCoerce
public interface CoercibleType<Canonical>
- extends Type, Serializable
Interface CoercibleType allows Fields
instances to be extended with custom
type information.
It is the role of implementations of this interface to maintain a canonical representation of a given value
and to allow for coercions between some type representation to the canonical type and back.
For example, if a field in a text delimited file is a date, ie. 28/Dec/2012:16:17:12:931 -0800
it may be beneficial for the internal representation to be a Long
value for performance reasons.
Note CoercibleType used in conjunction with the TextDelimited parsers is not a replacement for using
a pipe assembly to cleanse data. Pushing data cleansing down to a Tap
and
Scheme
may not provide the flexibility and robustness expected.
CoercibleTypes are a convenience when the input data is of high quality or was previously written out using
a CoercibleType instance.
The CoercibleTypes further allow the Cascading planner to perform type checks during joins. If no
Comparator
is in use, and lhs and rhs fields are not the same type, the planner will throw an
exception.
getCanonicalType
Class<Canonical> getCanonicalType()
- Returns:
- the actual Java type this CoercibleType represents
canonical
Canonical canonical(Object value)
- Parameters:
value
- of type Object
- Returns:
- the value coerced into its canonical type
coerce
<Coerce> Coerce coerce(Object value,
Type to)
- Parameters:
value
- of type Objectto
- of type Type
- Returns:
- the value coerced into the requested type
Copyright © 2007-2014 Concurrent, Inc. All Rights Reserved.