public abstract class Relation
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Operator |
relationType |
Constructor and Description |
---|
Relation() |
Modifier and Type | Method and Description |
---|---|
abstract java.util.List<? extends Term.Raw> |
getInValues()
Returns the list of raw IN values for this relation, or null if this is not an IN relation.
|
abstract Term.Raw |
getValue()
Returns the raw value for this relation, or null if this is an IN relation.
|
boolean |
isContains()
Checks if the operator of this relation is a
CONTAINS . |
boolean |
isContainsKey()
Checks if the operator of this relation is a
CONTAINS_KEY . |
boolean |
isEQ()
Checks if the operator of this relation is a
EQ . |
boolean |
isIN()
Checks if the operator of this relation is a
IN . |
boolean |
isLIKE() |
boolean |
isMultiColumn()
Checks if this relation apply to multiple columns.
|
boolean |
isSlice()
Checks if the operator of this relation is a
Slice (GT, GTE, LTE, LT). |
protected abstract Restriction |
newContainsRestriction(TableMetadata table,
VariableSpecifications boundNames,
boolean isKey)
Creates a new Contains restriction instance.
|
protected abstract Restriction |
newEQRestriction(TableMetadata table,
VariableSpecifications boundNames)
Creates a new EQ restriction instance.
|
protected abstract Restriction |
newINRestriction(TableMetadata table,
VariableSpecifications boundNames)
Creates a new IN restriction instance.
|
protected abstract Restriction |
newIsNotRestriction(TableMetadata table,
VariableSpecifications boundNames) |
protected abstract Restriction |
newLikeRestriction(TableMetadata table,
VariableSpecifications boundNames,
Operator operator) |
protected abstract Restriction |
newSliceRestriction(TableMetadata table,
VariableSpecifications boundNames,
Bound bound,
boolean inclusive)
Creates a new Slice restriction instance.
|
boolean |
onToken()
Checks if this relation is a token relation (e.g.
|
Operator |
operator() |
abstract Relation |
renameIdentifier(ColumnIdentifier from,
ColumnIdentifier to)
Renames an identifier in this Relation, if applicable.
|
abstract java.lang.String |
toCQLString()
Returns a CQL representation of this relation.
|
Restriction |
toRestriction(TableMetadata table,
VariableSpecifications boundNames)
Converts this
Relation into a Restriction . |
java.lang.String |
toString() |
protected abstract Term |
toTerm(java.util.List<? extends ColumnSpecification> receivers,
Term.Raw raw,
java.lang.String keyspace,
VariableSpecifications boundNames)
Converts the specified
Raw into a Term . |
protected java.util.List<Term> |
toTerms(java.util.List<? extends ColumnSpecification> receivers,
java.util.List<? extends Term.Raw> raws,
java.lang.String keyspace,
VariableSpecifications boundNames)
Converts the specified
Raw terms into a Term s. |
protected Operator relationType
public Operator operator()
public abstract Term.Raw getValue()
public abstract java.util.List<? extends Term.Raw> getInValues()
public boolean isMultiColumn()
true
if this relation apply to multiple columns, false
otherwise.public boolean onToken()
token(a) = token(1)).
true
if this relation is a token relation, false
otherwise.public final boolean isContains()
CONTAINS
.true
if the operator of this relation is a CONTAINS
, false
otherwise.public final boolean isContainsKey()
CONTAINS_KEY
.true
if the operator of this relation is a CONTAINS_KEY
, false
otherwise.public final boolean isIN()
IN
.true
if the operator of this relation is a IN
, false
otherwise.public final boolean isEQ()
EQ
.true
if the operator of this relation is a EQ
, false
otherwise.public final boolean isLIKE()
public final boolean isSlice()
Slice
(GT, GTE, LTE, LT).true
if the operator of this relation is a Slice
, false
otherwise.public final Restriction toRestriction(TableMetadata table, VariableSpecifications boundNames)
Relation
into a Restriction
.table
- the Column Family meta databoundNames
- the variables specification where to collect the bind variablesRestriction
corresponding to this Relation
InvalidRequestException
- if this Relation
is not validprotected abstract Restriction newEQRestriction(TableMetadata table, VariableSpecifications boundNames)
table
- the table meta databoundNames
- the variables specification where to collect the bind variablesInvalidRequestException
- if the relation cannot be converted into an EQ restriction.protected abstract Restriction newINRestriction(TableMetadata table, VariableSpecifications boundNames)
table
- the table meta databoundNames
- the variables specification where to collect the bind variablesInvalidRequestException
- if the relation cannot be converted into an IN restriction.protected abstract Restriction newSliceRestriction(TableMetadata table, VariableSpecifications boundNames, Bound bound, boolean inclusive)
table
- the table meta databoundNames
- the variables specification where to collect the bind variablesbound
- the slice boundinclusive
- true
if the bound is included.InvalidRequestException
- if the Relation
is not validprotected abstract Restriction newContainsRestriction(TableMetadata table, VariableSpecifications boundNames, boolean isKey)
table
- the table meta databoundNames
- the variables specification where to collect the bind variablesisKey
- true
if the restriction to create is a CONTAINS KEYRestriction
instanceInvalidRequestException
- if the Relation
is not validprotected abstract Restriction newIsNotRestriction(TableMetadata table, VariableSpecifications boundNames)
protected abstract Restriction newLikeRestriction(TableMetadata table, VariableSpecifications boundNames, Operator operator)
protected abstract Term toTerm(java.util.List<? extends ColumnSpecification> receivers, Term.Raw raw, java.lang.String keyspace, VariableSpecifications boundNames)
Raw
into a Term
.receivers
- the columns to which the values must be associated atraw
- the raw term to convertkeyspace
- the keyspace nameboundNames
- the variables specification where to collect the bind variablesTerm
corresponding to the specified Raw
InvalidRequestException
- if the Raw
term is not validprotected final java.util.List<Term> toTerms(java.util.List<? extends ColumnSpecification> receivers, java.util.List<? extends Term.Raw> raws, java.lang.String keyspace, VariableSpecifications boundNames)
Raw
terms into a Term
s.receivers
- the columns to which the values must be associated atraws
- the raw terms to convertkeyspace
- the keyspace nameboundNames
- the variables specification where to collect the bind variablesTerm
s corresponding to the specified Raw
termsInvalidRequestException
- if the Raw
terms are not validpublic abstract Relation renameIdentifier(ColumnIdentifier from, ColumnIdentifier to)
from
- the old identifierto
- the new identifierpublic abstract java.lang.String toCQLString()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009-2021 The Apache Software Foundation