|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cascading.tuple.TupleEntry
public class TupleEntry
Class TupleEntry allows a Tuple
instance and its declaring Fields
instance to be used as a single object.
long
, then entry.setString(0, "9" )
will coerce the "9" to a
long 9
. Thus, entry.getObject(0) == 9l
.
No coercion is performed with the getObject(Comparable)
and getObject(int)
methods.
To set a value without coercion, see the setRaw(Comparable, Object)
and setRaw(int, Object)
methods.
Fields
,
Tuple
Field Summary | |
---|---|
static TupleEntry |
NULL
An EMPTY TupleEntry instance for use as a stand in instead of a 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(Fields fields,
Tuple tuple,
boolean isUnmodifiable)
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. |
|
|
asIterableOf(Class<T> type)
Method asIterableOf returns an Iterable instance that will coerce all Tuple elements
into the given type parameter. |
|
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. |
|
Tuple |
getCoercedTuple(Type[] types)
Method getCoercedTuple is a helper method for copying the current tuple elements into a new Tuple, of the same size, as the requested coerced types. |
|
Tuple |
getCoercedTuple(Type[] types,
Tuple into)
Method getCoercedTuple is a helper method for copying the current tuple elements into the new Tuple, of the same size, as the requested coerced types. |
|
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 getObject returns the value in the given field or position. |
|
Object |
getObject(Comparable fieldName,
Type type)
Method getObject returns the value in the given field or position as the requested type. |
|
Object |
getObject(int pos)
Method getObject returns the value in the given position pos. |
|
Object |
getObject(int pos,
Type type)
Method getObject returns the value in the given field or position as the requested type. |
|
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 |
hasTypes()
Returns true if there are types associated with this instance. |
|
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 the selector from this instance. |
|
TupleEntry |
selectEntryCopy(Fields selector)
Method selectEntry selects the fields specified in selector from this instance. |
|
Tuple |
selectInto(Fields selector,
Tuple tuple)
Method selectInto selects the fields specified in the selector from this instance and copies them into the given tuple argument. |
|
Tuple |
selectTuple(Fields selector)
Method selectTuple selects the fields specified in the selector from this instance. |
|
Tuple |
selectTupleCopy(Fields selector)
Method selectTupleCopy selects the fields specified in selector from this instance. |
|
void |
set(Comparable fieldName,
Object value)
Deprecated. |
|
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 |
setCanonicalTuple(Tuple tuple)
Method setCanonicalTuple replaces each value of the current tuple with the given tuple elements after they are coerced. |
|
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 |
setObject(Comparable fieldName,
Object value)
Method set sets the value in the given field or position. |
|
void |
setRaw(Comparable fieldName,
Object value)
Method set sets the value in the given field or position. |
|
void |
setRaw(int pos,
Object value)
Method set sets the value in the given 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, the given values will always be copied into this TupleEntry. |
|
void |
setTuple(Tuple tuple)
Method setTuple sets the tuple of this TupleEntry object, no copy will be performed. |
|
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 |
---|
public static final TupleEntry NULL
null
.
Constructor Detail |
---|
public TupleEntry()
@ConstructorProperties(value="isUnmodifiable") public TupleEntry(boolean isUnmodifiable)
isUnmodifiable
- of type boolean@ConstructorProperties(value="fields") public TupleEntry(Fields fields)
fields
- of type Fields@ConstructorProperties(value={"fields","isUnmodifiable"}) public TupleEntry(Fields fields, boolean isUnmodifiable)
fields
- of type FieldsisUnmodifiable
- of type boolean@ConstructorProperties(value={"fields","tuple","isUnmodifiable"}) public TupleEntry(Fields fields, Tuple tuple, boolean isUnmodifiable)
fields
- of type Fieldstuple
- of type TupleisUnmodifiable
- of type boolean@ConstructorProperties(value={"fields","tuple"}) public TupleEntry(Fields fields, Tuple tuple)
fields
- of type Fieldstuple
- of type Tuple@ConstructorProperties(value="tupleEntry") public TupleEntry(TupleEntry tupleEntry)
tupleEntry
- of type TupleEntry@ConstructorProperties(value="tuple") public TupleEntry(Tuple tuple)
tuple
- of type TupleMethod Detail |
---|
public static Tuple select(Fields selector, TupleEntry... entries)
selector
- of type Fieldsentries
- of type TupleEntry
public boolean isUnmodifiable()
public Fields getFields()
public boolean hasTypes()
public Tuple getTuple()
public Tuple getTupleCopy()
public Tuple getCoercedTuple(Type[] types)
types
- of type Type[]
public Tuple getCoercedTuple(Type[] types, Tuple into)
types
- of type Type[]into
- of type Tuple
public void setTuple(Tuple tuple)
Tuple.isUnmodifiable() == true
) and this TupleEntry is
not "unmodifiable", a warning will be issued.
Unmodifiable tuples are generally owned by the system and cannot be be changed and must not be cached.
tuple
- the tuple of this TupleEntry object.public void setCanonicalTuple(Tuple tuple)
tuple
- to replace the current wrapped Tuple instancepublic int size()
@Deprecated public Comparable get(int pos)
getObject(int)
instead.
pos
- position of the element to return.
public Object getObject(int pos)
pos
- position of the element to return.
public Object getObject(int pos, Type type)
pos
- position of the element to return.
@Deprecated public Comparable get(Comparable fieldName)
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.
fieldName
- field name or position to return
public Object getObject(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
No coercion is performed if there is an associated coercible type.
fieldName
- field name or position to return
public Object getObject(Comparable fieldName, Type type)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
Coercion is performed to the given type.
fieldName
- field name or position to return
@Deprecated public void set(Comparable fieldName, Object value)
setRaw(Comparable, Object)
fieldName
- field name or position to setvalue
- of type Comparablepublic void setRaw(int pos, Object value)
pos
- position to setvalue
- of type Comparablepublic void setRaw(Comparable fieldName, Object value)
fieldName
- field name or position to setvalue
- of type Comparablepublic void setObject(Comparable fieldName, Object value)
fieldName
- field name or position to setvalue
- of type Comparablepublic void setBoolean(Comparable fieldName, boolean value)
fieldName
- field name or position to setvalue
- of type booleanpublic void setShort(Comparable fieldName, short value)
fieldName
- field name or position to setvalue
- of type shortpublic void setInteger(Comparable fieldName, int value)
fieldName
- field name or position to setvalue
- of type intpublic void setLong(Comparable fieldName, long value)
fieldName
- field name or position to setvalue
- of type longpublic void setFloat(Comparable fieldName, float value)
fieldName
- field name or position to setvalue
- of type floatpublic void setDouble(Comparable fieldName, double value)
fieldName
- field name or position to setvalue
- of type doublepublic void setString(Comparable fieldName, String value)
fieldName
- field name or position to setvalue
- of type Stringpublic String getString(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
fieldName
- field name or position to return
public float getFloat(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
fieldName
- field name or position to return
public double getDouble(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
fieldName
- field name or position to return
public int getInteger(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
fieldName
- field name or position to return
public long getLong(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
fieldName
- field name or position to return
public short getShort(Comparable fieldName)
fieldName
may optionally be a Fields
instance. Only the first field name or position will
be considered.
fieldName
- field name or position to return
public boolean getBoolean(Comparable fieldName)
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.
fieldName
- field name or position to return
public TupleEntry selectEntry(Fields selector)
Fields.ALL
or the
same fields as declared are given, this
will be returned.
The returned TupleEntry will be either modifiable or unmodifiable, depending on the state of this TupleEntry instance.
See selectEntryCopy(Fields)
to guarantee a copy suitable for modifying or caching/storing in a collection.
Note this is a bug fix and change from 2.0 and 2.1. In previous versions the modifiable state was dependent
on the given selector.
selector
- Fields selector that selects the values to return
public TupleEntry selectEntryCopy(Fields selector)
selector
- Fields selector that selects the values to return
public Tuple selectTuple(Fields selector)
Fields.ALL
or the
same fields as declared are given, this.getTuple()
will be returned.
The returned Tuple will be either modifiable or unmodifiable, depending on the state of this TupleEntry instance.
See selectTupleCopy(Fields)
to guarantee a copy suitable for modifying or caching/storing in a collection.
Note this is a bug fix and change from 2.0 and 2.1. In previous versions the modifiable state was dependent
on the given selector.
selector
- Fields selector that selects the values to return
public Tuple selectTupleCopy(Fields selector)
selector
- Fields selector that selects the values to return
public Tuple selectInto(Fields selector, Tuple tuple)
selector
- of type Fieldstuple
- of type Tuple
public void setTuple(Fields selector, Tuple tuple)
selector
- of type Fieldstuple
- of type Tuplepublic void set(TupleEntry tupleEntry)
tupleEntry
- of type TupleEntrypublic TupleEntry appendNew(TupleEntry entry)
entry
- of type TupleEntry
public boolean equals(Object object)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public <T> Iterable<T> asIterableOf(Class<T> type)
Iterable
instance that will coerce all Tuple elements
into the given type
parameter.
This method honors any CoercibleType
instances on the internal
Fields instance for the specified Tuple element.
type
- of type Class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |