cascading.tuple
Class Tuples

java.lang.Object
  extended by cascading.tuple.Tuples

public class Tuples
extends Object

Class Tuples is a helper class providing common methods to manipulate Tuple instances.


Field Summary
static Tuple NULL
          A constant empty Tuple instance.
 
Constructor Summary
Tuples()
           
 
Method Summary
static Object[] asArray(Tuple tuple, Class[] types)
          Method asArray convert the given Tuple instance into an Object[].
static Object[] asArray(Tuple tuple, Class[] types, Object[] destination)
          Method asArray convert the given Tuple instance into an Object[].
static Tuple coerce(Tuple tuple, Class[] types)
          Method coerce forces each element value in the given Tuple to the corresponding primitive type.
static Object coerce(Tuple tuple, int pos, Class type)
          Method coerce returns the value in the tuple at the given position to the requested type.
static Tuple extract(TupleEntry tupleEntry, Fields selector)
          Method extract creates a new Tuple from the given selector, but sets the values in the current tuple to null.
static Tuple extractTuple(TupleEntry tupleEntry, Fields selector)
          Method extractTuple returns a new Tuple based on the given selector.
static Tuple setOnEmpty(TupleEntry baseEntry, TupleEntry valuesEntry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final Tuple NULL
A constant empty Tuple instance. Immutability is not currently enforced. Use with caution.

Constructor Detail

Tuples

public Tuples()
Method Detail

asArray

public static Object[] asArray(Tuple tuple,
                               Class[] types)
Method asArray convert the given Tuple instance into an Object[]. The given Class[] array denotes the types each tuple element value should be coerced into.

Coercion types are Object, String, Integer, Long, Float, Double, Short, and Boolean.

If all Tuple element values are null, they will remain null for String and Object, but become zero for the numeric types.

The string value 'true' can be converted to the boolean true.

Parameters:
tuple - of type Tuple
types - of type Class[]
Returns:
Object[]

asArray

public static Object[] asArray(Tuple tuple,
                               Class[] types,
                               Object[] destination)
Method asArray convert the given Tuple instance into an Object[]. The given Class[] array denotes the types each tuple element value should be coerced into.

Parameters:
tuple - of type Tuple
types - of type Class[]
destination - of type Object[]
Returns:
Object[]

coerce

public static Object coerce(Tuple tuple,
                            int pos,
                            Class type)
Method coerce returns the value in the tuple at the given position to the requested type.

Parameters:
tuple - of type Tuple
pos - of type int
type - of type Class
Returns:
returns the value coerced

coerce

public static Tuple coerce(Tuple tuple,
                           Class[] types)
Method coerce forces each element value in the given Tuple to the corresponding primitive type.

Parameters:
tuple - of type Tuple
types - of type Class[]
Returns:
Tuple

extractTuple

public static Tuple extractTuple(TupleEntry tupleEntry,
                                 Fields selector)
Method extractTuple returns a new Tuple based on the given selector. But sets the values of this entries Tuple to null.

Parameters:
tupleEntry - of type TupleEntry
selector - of type Fields
Returns:
Tuple

extract

public static Tuple extract(TupleEntry tupleEntry,
                            Fields selector)
Method extract creates a new Tuple from the given selector, but sets the values in the current tuple to null.

Parameters:
tupleEntry - of type TupleEntry
selector - of type Fields
Returns:
Tuple

setOnEmpty

public static Tuple setOnEmpty(TupleEntry baseEntry,
                               TupleEntry valuesEntry)


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