Package org.apache.cassandra.cql3
Class Tuples
- java.lang.Object
-
- org.apache.cassandra.cql3.Tuples
-
public class Tuples extends java.lang.Object
Static helper methods and classes for tuples.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Tuples.DelayedValue
Similar to Value, but contains at least one NonTerminal, such as a non-pure functions or bind marker.static class
Tuples.InMarker
Represents a marker for a set of IN values that are tuples, like "SELECT ...static class
Tuples.INRaw
A raw marker for an IN list of tuples, like "SELECT ...static class
Tuples.InValue
A terminal value for a list of IN values that are tuples.static class
Tuples.Literal
A raw, literal tuple.static class
Tuples.Marker
Represents a marker for a single tuple, like "SELECT ... WHERE (a, b, c) > ?"
static class
Tuples.Raw
A raw placeholder for a tuple of values for different multiple columns, each of which may have a different type.static class
Tuples.Value
A tuple of terminal values (e.g (123, 'abc')).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
checkIfTupleType(AbstractType<?> tuple)
static ColumnSpecification
componentSpecOf(ColumnSpecification column, int component)
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.static TupleType
getTupleType(AbstractType<?> tuple)
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.static <T> java.lang.String
tupleToString(java.lang.Iterable<T> items, java.util.function.Function<T,java.lang.String> mapper)
Create aString
representation of the tuple from the specified items associated to the tuples elements.static java.lang.String
tupleToString(java.util.List<?> elements)
Create aString
representation of the tuple containing the specified elements.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.
-
-
-
Method Detail
-
componentSpecOf
public static ColumnSpecification componentSpecOf(ColumnSpecification column, int component)
-
tupleToString
public static java.lang.String tupleToString(java.util.List<?> elements)
Create aString
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 aString
representation of the tuple from the specified items associated to the tuples elements.- Parameters:
items
- items associated to the tuple elementsmapper
- the mapper used to map the items to theString
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 elementsmapper
- 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 columnelements
- 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 columnelements
- the tuple elements
-
checkIfTupleType
public static boolean checkIfTupleType(AbstractType<?> tuple)
-
getTupleType
public static TupleType getTupleType(AbstractType<?> tuple)
-
-