Class Tuples


  • public class Tuples
    extends java.lang.Object
    Static helper methods and classes for tuples.
    • Method Detail

      • tupleToString

        public static java.lang.String tupleToString​(java.util.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> java.lang.String tupleToString​(java.lang.Iterable<T> items,
                                                         java.util.function.Function<T,​java.lang.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> AbstractType<?> getExactTupleTypeIfKnown​(java.util.List<T> items,
                                                                   java.util.function.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,
                                                     java.util.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,
                                                                        java.util.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)