Package org.apache.ignite.table
Class TupleHelper
java.lang.Object
org.apache.ignite.table.TupleHelper
Utility class to provide direct access to internals of
TupleImpl.-
Method Summary
Modifier and TypeMethodDescriptionstatic TuplecopyColumns(Tuple tuple, List<String> normalizedColumnNames) Copy the specified columns into a new tuple.static voidsetNormalized(Tuple tuple, String normalizedName, @Nullable Object val) An alternative toTuple.set(java.lang.String, java.lang.Object)that allows to set a value for a column, which name is already normalized.static <T> TvalueOrDefault(Tuple tuple, String normalizedName, T defaultValue) Returns value from a given tuple which corresponds to a specified column.
-
Method Details
-
valueOrDefault
@Nullable public static <T> T valueOrDefault(Tuple tuple, String normalizedName, @Nullable T defaultValue) Returns value from a given tuple which corresponds to a specified column.Given name is expected to be normalized, thus it's up to caller to invoke
IgniteNameUtils.parseIdentifier(String)prior passing the name to this method.- Type Parameters:
T- A type of the returned value.- Parameters:
tuple- A tuple to get value from.normalizedName- A column name that is considered to be normalized (e.g result ofIgniteNameUtils.parseIdentifier(String)).defaultValue- A value to return in case tuple doesn't have column with given name.- Returns:
- A value from a tuple.
-
copyColumns
Copy the specified columns into a new tuple. The specified column names should already be normalized. If a column does not exist in the source tuple it will be skipped.- Parameters:
tuple- Source tuple.normalizedColumnNames- Column names to be copied.- Returns:
- The target tuple, a copy of the original tuple retaining only the specified columns.
-
setNormalized
public static void setNormalized(Tuple tuple, String normalizedName, @Nullable @Nullable Object val) An alternative toTuple.set(java.lang.String, java.lang.Object)that allows to set a value for a column, which name is already normalized.Since the column name is considered normalized, it's up to caller to invoke
IgniteNameUtils.parseIdentifier(java.lang.String)prior passing the name to this method.- Parameters:
tuple- A tuple which column will be set.normalizedName- A column name that is considered to be normalized (e.g result ofIgniteNameUtils.parseIdentifier(java.lang.String)).
-