Package org.apache.cassandra.cql3
Class Constants.Literal
- java.lang.Object
-
- org.apache.cassandra.cql3.Term.Raw
-
- org.apache.cassandra.cql3.Constants.Literal
-
- All Implemented Interfaces:
AssignmentTestable
- Enclosing class:
- Constants
public static class Constants.Literal extends Term.Raw
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.cql3.AssignmentTestable
AssignmentTestable.TestResult
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Constants.Literal
bool(java.lang.String text)
static Constants.Literal
duration(java.lang.String text)
static Constants.Literal
floatingPoint(java.lang.String text)
AbstractType<?>
getCompatibleTypeIfKnown(java.lang.String keyspace)
AbstractType<?>
getExactTypeIfKnown(java.lang.String keyspace)
The type of theterm
if it can be infered.java.lang.String
getRawText()
java.lang.String
getText()
static Constants.Literal
hex(java.lang.String text)
static Constants.Literal
integer(java.lang.String text)
Constants.Value
prepare(java.lang.String keyspace, ColumnSpecification receiver)
This method validates this RawTerm is valid for provided column specification and "prepare" this RawTerm, returning the resulting prepared Term.static Constants.Literal
string(java.lang.String text)
AssignmentTestable.TestResult
testAssignment(java.lang.String keyspace, ColumnSpecification receiver)
static Constants.Literal
uuid(java.lang.String text)
-
-
-
Method Detail
-
string
public static Constants.Literal string(java.lang.String text)
-
integer
public static Constants.Literal integer(java.lang.String text)
-
floatingPoint
public static Constants.Literal floatingPoint(java.lang.String text)
-
uuid
public static Constants.Literal uuid(java.lang.String text)
-
bool
public static Constants.Literal bool(java.lang.String text)
-
hex
public static Constants.Literal hex(java.lang.String text)
-
duration
public static Constants.Literal duration(java.lang.String text)
-
prepare
public Constants.Value prepare(java.lang.String keyspace, ColumnSpecification receiver) throws InvalidRequestException
Description copied from class:Term.Raw
This method validates this RawTerm is valid for provided column specification and "prepare" this RawTerm, returning the resulting prepared Term.- Specified by:
prepare
in classTerm.Raw
receiver
- the "column" this RawTerm is supposed to be a value of. Note that the ColumnSpecification may not correspond to a real column in the case this RawTerm describe a list index or a map key, etc...- Returns:
- the prepared term.
- Throws:
InvalidRequestException
-
testAssignment
public AssignmentTestable.TestResult testAssignment(java.lang.String keyspace, ColumnSpecification receiver)
- Returns:
- whether this object can be assigned to the provided receiver. We distinguish between 3 values: - EXACT_MATCH if this object is exactly of the type expected by the receiver - WEAKLY_ASSIGNABLE if this object is not exactly the expected type but is assignable nonetheless - NOT_ASSIGNABLE if it's not assignable Most caller should just call the isAssignable() method on the result, though functions have a use for testing "strong" equality to decide the most precise overload to pick when multiple could match.
-
getExactTypeIfKnown
public AbstractType<?> getExactTypeIfKnown(java.lang.String keyspace)
Description copied from class:Term.Raw
The type of theterm
if it can be infered.- Specified by:
getExactTypeIfKnown
in classTerm.Raw
- Parameters:
keyspace
- the keyspace on which the statement containing this term is on.- Returns:
- the type of this
Term
if inferrable, ornull
otherwise (for instance, the type isn't inferrable for a bind marker. Even for literals, the exact type is not inferrable since they are valid for many different types and so this will returnnull
too).
-
getCompatibleTypeIfKnown
public AbstractType<?> getCompatibleTypeIfKnown(java.lang.String keyspace)
- Specified by:
getCompatibleTypeIfKnown
in interfaceAssignmentTestable
- Overrides:
getCompatibleTypeIfKnown
in classTerm.Raw
- Returns:
- A data type that can represent this, or
null
if we can't determine that type. The returned type won't necessarely be the exact type, but one that is compatible with it.
-
getRawText
public java.lang.String getRawText()
-
-