@Public public abstract class Tuple extends Object implements Serializable
Tuple1
to Tuple25
.
The fields in the tuples may be accessed directly a public fields, or via position (zero
indexed) getField(int)
.
Tuples are in principle serializable. However, they may contain non-serializable fields, in which case serialization will fail.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_ARITY |
Constructor and Description |
---|
Tuple() |
Modifier and Type | Method and Description |
---|---|
abstract <T extends Tuple> |
copy()
Shallow tuple copy.
|
abstract int |
getArity()
Gets the number of field in the tuple (the tuple arity).
|
abstract <T> T |
getField(int pos)
Gets the field at the specified position.
|
<T> T |
getFieldNotNull(int pos)
Gets the field at the specified position, throws NullFieldException if the field is null.
|
static Class<? extends Tuple> |
getTupleClass(int arity)
Gets the class corresponding to the tuple of the given arity (dimensions).
|
static Tuple |
newInstance(int arity) |
abstract <T> void |
setField(T value,
int pos)
Sets the field at the specified position.
|
public static final int MAX_ARITY
public abstract <T> T getField(int pos)
pos
- The position of the field, zero indexed.IndexOutOfBoundsException
- Thrown, if the position is negative, or equal to, or larger
than the number of fields.public <T> T getFieldNotNull(int pos)
pos
- The position of the field, zero indexed.IndexOutOfBoundsException
- Thrown, if the position is negative, or equal to, or larger
than the number of fields.NullFieldException
- Thrown, if the field at pos is null.public abstract <T> void setField(T value, int pos)
value
- The value to be assigned to the field at the specified position.pos
- The position of the field, zero indexed.IndexOutOfBoundsException
- Thrown, if the position is negative, or equal to, or larger
than the number of fields.public abstract int getArity()
public abstract <T extends Tuple> T copy()
public static Class<? extends Tuple> getTupleClass(int arity)
getTupleClass(3)
will return the Tuple3.class
.arity
- The arity of the tuple class to get.public static Tuple newInstance(int arity)
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.