Class Tuples

java.lang.Object
org.apache.cassandra.cql3.Tuples

public class Tuples extends Object
Static helper methods and classes for tuples.
  • Method Details

    • componentSpecOf

      public static ColumnSpecification componentSpecOf(ColumnSpecification column, int component)
    • tupleToString

      public static String tupleToString(List<?> elements)
      Create a String representation of the tuple containing the specified elements.
      Parameters:
      elements - the tuple elements
      Returns:
      a String representation of the tuple
    • tupleToString

      public static <T> String tupleToString(Iterable<T> items, Function<T,String> mapper)
      Create a String representation of the tuple from the specified items associated to the tuples elements.
      Parameters:
      items - items associated to the tuple elements
      mapper - the mapper used to map the items to the String representation of the tuple elements
      Returns:
      a String representation of the tuple
    • getExactTupleTypeIfKnown

      public static <T> TupleType getExactTupleTypeIfKnown(List<T> items, Function<T,AbstractType<?>> mapper)
      Returns the exact TupleType from the items if it can be known.
      Parameters:
      items - the items mapped to the tuple elements
      mapper - the mapper used to retrieve the element types from the items
      Returns:
      the exact TupleType from the items if it can be known or null
    • validateTupleAssignableTo

      public static void validateTupleAssignableTo(ColumnSpecification receiver, List<? extends AssignmentTestable> elements)
      Checks if the tuple with the specified elements can be assigned to the specified column.
      Parameters:
      receiver - the receiving column
      elements - the tuple elements
      Throws:
      InvalidRequestException - if the tuple cannot be assigned to the specified column.
    • testTupleAssignment

      public static AssignmentTestable.TestResult testTupleAssignment(ColumnSpecification receiver, List<? extends AssignmentTestable> elements)
      Tests that the tuple with the specified elements can be assigned to the specified column.
      Parameters:
      receiver - the receiving column
      elements - the tuple elements
    • checkIfTupleType

      public static boolean checkIfTupleType(AbstractType<?> tuple)
    • getTupleType

      public static TupleType getTupleType(AbstractType<?> tuple)