## cascading.tuple
Class Tuples

    java.lang.Object
      cascading.tuple.Tuples

    public class Tuples

extends Object

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

See Also:
  `Tuple`, `TupleEntry`

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 Object[]` `asArray(Tuple tuple, Object[] destination)` Method asArray copies the elements of the given Tuple instance to the given Object array.
`static Tuple` `asModifiable(Tuple tuple)` Method asModifiable marks the given Tuple instance as modifiable.
`static Tuple` `asUnmodifiable(Tuple tuple)` Method asUnmodifiable marks the given Tuple instance as unmodifiable.
`static Object` `coerce(Object value, Class type)`
`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)`
`static boolean` `toBoolean(Object value)`
`static double` `toDouble(Object value)`
`static float` `toFloat(Object value)`
`static int` `toInteger(Object value)`
`static long` `toLong(Object value)`
`static short` `toShort(Object value)`
`static String` `toString(Object value)`

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. This instance is immutable.

Constructor Detail

### Tuples

    public Tuples()

Method Detail

### asArray

    public static Object[] asArray(Tuple tuple,
                                   Object[] destination)

  Method asArray copies the elements of the given Tuple instance to the given Object array.

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

### 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 Object coerce(Object value,
                                Class type)

### toString

    public static final String toString(Object value)

### toInteger

    public static final int toInteger(Object value)

### toLong

    public static final long toLong(Object value)

### toDouble

    public static final double toDouble(Object value)

### toFloat

    public static final float toFloat(Object value)

### toShort

    public static final short toShort(Object value)

### toBoolean

    public static final boolean toBoolean(Object value)

### 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 the given TupleEntry 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)

### asUnmodifiable

    public static Tuple asUnmodifiable(Tuple tuple)

  Method asUnmodifiable marks the given Tuple instance as unmodifiable.

  Parameters:
    `tuple` - of type Tuple
  Returns:
    Tuple

### asModifiable

    public static Tuple asModifiable(Tuple tuple)

  Method asModifiable marks the given Tuple instance as modifiable.

  Parameters:
    `tuple` - of type Tuple
  Returns:
    Tuple

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