Class TupleHelper

java.lang.Object
org.apache.ignite.table.TupleHelper

public final class TupleHelper extends Object
Utility class to provide direct access to internals of TupleImpl.
  • 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 of IgniteNameUtils.parseIdentifier(String)).
      defaultValue - A value to return in case tuple doesn't have column with given name.
      Returns:
      A value from a tuple.
    • copyColumns

      public static Tuple copyColumns(Tuple tuple, List<String> normalizedColumnNames)
      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 to Tuple.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 of IgniteNameUtils.parseIdentifier(java.lang.String)).