cascading.tuple
Class TupleEntry

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

public class TupleEntry
extends Object

Class TupleEntry allows a Tuple instance and its declaring Fields instance to be used as a single object.

Once a TupleEntry is created, its Fields cannot be changed, but the Tuple instance it holds can be replaced or modified. The managed Tuple should not have elements added or removed, as this will break the relationship with the associated Fields instance.

See Also:
Fields, Tuple

Field Summary
static TupleEntry NULL
           
 
Constructor Summary
TupleEntry()
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(boolean isUnmodifiable)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Fields fields)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Fields fields, boolean isUnmodifiable)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Fields fields, Tuple tuple)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(Tuple tuple)
          Constructor TupleEntry creates a new TupleEntry instance.
TupleEntry(TupleEntry tupleEntry)
          Constructor TupleEntry creates a new TupleEntry instance that is a safe copy of the given tupleEntry.
 
Method Summary
 TupleEntry appendNew(TupleEntry entry)
          Method appendNew appends the given TupleEntry instance to this instance.
 boolean equals(Object object)
           
 Comparable get(Comparable fieldName)
          Deprecated. 
 Comparable get(int pos)
          Deprecated. 
 boolean getBoolean(Comparable fieldName)
          Method getBoolean returns the element for the given field name or position as a boolean.
 double getDouble(Comparable fieldName)
          Method getDouble returns the element for the given field name or position as a double.
 Fields getFields()
          Method getFields returns the fields of this TupleEntry object.
 float getFloat(Comparable fieldName)
          Method getFloat returns the element for the given field name or position as a float.
 int getInteger(Comparable fieldName)
          Method getInteger returns the element for the given field name or position as an int.
 long getLong(Comparable fieldName)
          Method getLong returns the element for the given field name or position as a long.
 Object getObject(Comparable fieldName)
          Method get returns the value in the given field or position.
 Object getObject(int pos)
          Method get returns the value in the given position pos.
 short getShort(Comparable fieldName)
          Method getShort returns the element for the given field name or position as a short.
 String getString(Comparable fieldName)
          Method getString returns the element for the given field name or position as a String.
 Tuple getTuple()
          Method getTuple returns the tuple of this TupleEntry object.
 Tuple getTupleCopy()
          Method getTupleCopy returns a copy of the tuple of this TupleEntry object.
 int hashCode()
           
 boolean isUnmodifiable()
          Method isUnmodifiable returns true if this TupleEntry is unmodifiable.
static Tuple select(Fields selector, TupleEntry... entries)
          Method select will select a new Tuple instance from the given set of entries.
 TupleEntry selectEntry(Fields selector)
          Method selectEntry selects the fields specified in selector from this instance.
 Tuple selectTuple(Fields selector)
          Method selectTuple selects the fields specified in selector from this instance.
 void set(Comparable fieldName, Object value)
          Method set sets the value in the given field or position.
 void set(TupleEntry tupleEntry)
          Method set sets the values from the given tupleEntry into this TupleEntry instance based on the given tupleEntry field names.
 void setBoolean(Comparable fieldName, boolean value)
          Method setBoolean sets the value in the given field or position.
 void setDouble(Comparable fieldName, double value)
          Method setDouble sets the value in the given field or position.
 void setFloat(Comparable fieldName, float value)
          Method setFloat sets the value in the given field or position.
 void setInteger(Comparable fieldName, int value)
          Method setInteger sets the value in the given field or position.
 void setLong(Comparable fieldName, long value)
          Method setLong sets the value in the given field or position.
 void setShort(Comparable fieldName, short value)
          Method setShort sets the value in the given field or position.
 void setString(Comparable fieldName, String value)
          Method setString sets the value in the given field or position.
 void setTuple(Fields selector, Tuple tuple)
          Method setTuple sets the values specified by the selector to the values given by the given tuple.
 void setTuple(Tuple tuple)
          Method setTuple sets the tuple of this TupleEntry object.
 int size()
          Method size returns the number of values in this instance.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

public static final TupleEntry NULL
Constructor Detail

TupleEntry

public TupleEntry()
Constructor TupleEntry creates a new TupleEntry instance.


TupleEntry

@ConstructorProperties(value="isUnmodifiable")
public TupleEntry(boolean isUnmodifiable)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
isUnmodifiable - of type boolean

TupleEntry

@ConstructorProperties(value="fields")
public TupleEntry(Fields fields)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
fields - of type Fields

TupleEntry

@ConstructorProperties(value={"fields","isUnmodifiable"})
public TupleEntry(Fields fields,
                                             boolean isUnmodifiable)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
fields - of type Fields
isUnmodifiable - of type boolean

TupleEntry

@ConstructorProperties(value={"fields","tuple"})
public TupleEntry(Fields fields,
                                             Tuple tuple)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
fields - of type Fields
tuple - of type Tuple

TupleEntry

@ConstructorProperties(value="tupleEntry")
public TupleEntry(TupleEntry tupleEntry)
Constructor TupleEntry creates a new TupleEntry instance that is a safe copy of the given tupleEntry.

Parameters:
tupleEntry - of type TupleEntry

TupleEntry

@ConstructorProperties(value="tuple")
public TupleEntry(Tuple tuple)
Constructor TupleEntry creates a new TupleEntry instance.

Parameters:
tuple - of type Tuple
Method Detail

select

public static Tuple select(Fields selector,
                           TupleEntry... entries)
Method select will select a new Tuple instance from the given set of entries. Entries order is significant to the selector.

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

isUnmodifiable

public boolean isUnmodifiable()
Method isUnmodifiable returns true if this TupleEntry is unmodifiable.

Returns:
boolean

getFields

public Fields getFields()
Method getFields returns the fields of this TupleEntry object.

Returns:
the fields (type Fields) of this TupleEntry object.

getTuple

public Tuple getTuple()
Method getTuple returns the tuple of this TupleEntry object.

Returns:
the tuple (type Tuple) of this TupleEntry object.

getTupleCopy

public Tuple getTupleCopy()
Method getTupleCopy returns a copy of the tuple of this TupleEntry object.

Returns:
a copy of the tuple (type Tuple) of this TupleEntry object.

setTuple

public void setTuple(Tuple tuple)
Method setTuple sets the tuple of this TupleEntry object.

Parameters:
tuple - the tuple of this TupleEntry object.

size

public int size()
Method size returns the number of values in this instance.

Returns:
int

get

@Deprecated
public Comparable get(int pos)
Deprecated. 

Method get returns the value in the given position pos.

This method is deprecated, use getObject(int) instead.

Parameters:
pos - position of the element to return.
Returns:
Comparable

getObject

public Object getObject(int pos)
Method get returns the value in the given position pos.

Parameters:
pos - position of the element to return.
Returns:
Object

get

@Deprecated
public Comparable get(Comparable fieldName)
Deprecated. 

Method get returns the value in the given field or position.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

This method is deprecated, use getObject(Comparable) instead.

Parameters:
fieldName - field name or position to return
Returns:
Comparable

getObject

public Object getObject(Comparable fieldName)
Method get returns the value in the given field or position.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
Comparable

set

public void set(Comparable fieldName,
                Object value)
Method set sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type Comparable

setBoolean

public void setBoolean(Comparable fieldName,
                       boolean value)
Method setBoolean sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type boolean

setShort

public void setShort(Comparable fieldName,
                     short value)
Method setShort sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type short

setInteger

public void setInteger(Comparable fieldName,
                       int value)
Method setInteger sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type int

setLong

public void setLong(Comparable fieldName,
                    long value)
Method setLong sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type long

setFloat

public void setFloat(Comparable fieldName,
                     float value)
Method setFloat sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type float

setDouble

public void setDouble(Comparable fieldName,
                      double value)
Method setDouble sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type double

setString

public void setString(Comparable fieldName,
                      String value)
Method setString sets the value in the given field or position.

Parameters:
fieldName - field name or position to set
value - of type String

getString

public String getString(Comparable fieldName)
Method getString returns the element for the given field name or position as a String.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
String

getFloat

public float getFloat(Comparable fieldName)
Method getFloat returns the element for the given field name or position as a float. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
float

getDouble

public double getDouble(Comparable fieldName)
Method getDouble returns the element for the given field name or position as a double. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
double

getInteger

public int getInteger(Comparable fieldName)
Method getInteger returns the element for the given field name or position as an int. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
int

getLong

public long getLong(Comparable fieldName)
Method getLong returns the element for the given field name or position as a long. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
long

getShort

public short getShort(Comparable fieldName)
Method getShort returns the element for the given field name or position as a short. Zero if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
short

getBoolean

public boolean getBoolean(Comparable fieldName)
Method getBoolean returns the element for the given field name or position as a boolean. If the value is (case ignored) the string 'true', a true value will be returned. false if null.
fieldName may optionally be a Fields instance. Only the first field name or position will be considered.

Parameters:
fieldName - field name or position to return
Returns:
boolean

selectEntry

public TupleEntry selectEntry(Fields selector)
Method selectEntry selects the fields specified in selector from this instance.

Parameters:
selector - Fields selector that selects the values to return
Returns:
TupleEntry

selectTuple

public Tuple selectTuple(Fields selector)
Method selectTuple selects the fields specified in selector from this instance.

Parameters:
selector - Fields selector that selects the values to return
Returns:
Tuple

setTuple

public void setTuple(Fields selector,
                     Tuple tuple)
Method setTuple sets the values specified by the selector to the values given by the given tuple.

Parameters:
selector - of type Fields
tuple - of type Tuple

set

public void set(TupleEntry tupleEntry)
Method set sets the values from the given tupleEntry into this TupleEntry instance based on the given tupleEntry field names.

Parameters:
tupleEntry - of type TupleEntry

appendNew

public TupleEntry appendNew(TupleEntry entry)
Method appendNew appends the given TupleEntry instance to this instance.

Parameters:
entry - of type TupleEntry
Returns:
TupleEntry

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


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