Class Relation

    • Field Detail

      • relationType

        protected Operator relationType
    • Constructor Detail

      • Relation

        public Relation()
    • Method Detail

      • getValue

        public abstract Term.Raw getValue()
        Returns the raw value for this relation, or null if this is an IN relation.
      • getInValues

        public 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.
      • isMultiColumn

        public boolean isMultiColumn()
        Checks if this relation apply to multiple columns.
        Returns:
        true if this relation apply to multiple columns, false otherwise.
      • onToken

        public boolean onToken()
        Checks if this relation is a token relation (e.g.
        token(a) = token(1)
        ).
        Returns:
        true if this relation is a token relation, false otherwise.
      • isContains

        public final boolean isContains()
        Checks if the operator of this relation is a CONTAINS.
        Returns:
        true if the operator of this relation is a CONTAINS, false otherwise.
      • isContainsKey

        public final boolean isContainsKey()
        Checks if the operator of this relation is a CONTAINS_KEY.
        Returns:
        true if the operator of this relation is a CONTAINS_KEY, false otherwise.
      • isIN

        public final boolean isIN()
        Checks if the operator of this relation is a IN.
        Returns:
        true if the operator of this relation is a IN, false otherwise.
      • isEQ

        public final boolean isEQ()
        Checks if the operator of this relation is a EQ.
        Returns:
        true if the operator of this relation is a EQ, false otherwise.
      • isLIKE

        public final boolean isLIKE()
      • isSlice

        public final boolean isSlice()
        Checks if the operator of this relation is a Slice (GT, GTE, LTE, LT).
        Returns:
        true if the operator of this relation is a Slice, false otherwise.
      • toRestriction

        public final Restriction toRestriction​(TableMetadata table,
                                               VariableSpecifications boundNames)
        Converts this Relation into a Restriction.
        Parameters:
        table - the Column Family meta data
        boundNames - the variables specification where to collect the bind variables
        Returns:
        the Restriction corresponding to this Relation
        Throws:
        InvalidRequestException - if this Relation is not valid
      • newEQRestriction

        protected abstract Restriction newEQRestriction​(TableMetadata table,
                                                        VariableSpecifications boundNames)
        Creates a new EQ restriction instance.
        Parameters:
        table - the table meta data
        boundNames - the variables specification where to collect the bind variables
        Returns:
        a new EQ restriction instance.
        Throws:
        InvalidRequestException - if the relation cannot be converted into an EQ restriction.
      • newINRestriction

        protected abstract Restriction newINRestriction​(TableMetadata table,
                                                        VariableSpecifications boundNames)
        Creates a new IN restriction instance.
        Parameters:
        table - the table meta data
        boundNames - the variables specification where to collect the bind variables
        Returns:
        a new IN restriction instance
        Throws:
        InvalidRequestException - if the relation cannot be converted into an IN restriction.
      • newSliceRestriction

        protected abstract Restriction newSliceRestriction​(TableMetadata table,
                                                           VariableSpecifications boundNames,
                                                           Bound bound,
                                                           boolean inclusive)
        Creates a new Slice restriction instance.
        Parameters:
        table - the table meta data
        boundNames - the variables specification where to collect the bind variables
        bound - the slice bound
        inclusive - true if the bound is included.
        Returns:
        a new slice restriction instance
        Throws:
        InvalidRequestException - if the Relation is not valid
      • newContainsRestriction

        protected abstract Restriction newContainsRestriction​(TableMetadata table,
                                                              VariableSpecifications boundNames,
                                                              boolean isKey)
        Creates a new Contains restriction instance.
        Parameters:
        table - the table meta data
        boundNames - the variables specification where to collect the bind variables
        isKey - true if the restriction to create is a CONTAINS KEY
        Returns:
        a new Contains Restriction instance
        Throws:
        InvalidRequestException - if the Relation is not valid
      • toTerm

        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.
        Parameters:
        receivers - the columns to which the values must be associated at
        raw - the raw term to convert
        keyspace - the keyspace name
        boundNames - the variables specification where to collect the bind variables
        Returns:
        the Term corresponding to the specified Raw
        Throws:
        InvalidRequestException - if the Raw term is not valid
      • toTerms

        protected 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)
        Converts the specified Raw terms into a Terms.
        Parameters:
        receivers - the columns to which the values must be associated at
        raws - the raw terms to convert
        keyspace - the keyspace name
        boundNames - the variables specification where to collect the bind variables
        Returns:
        the Terms corresponding to the specified Raw terms
        Throws:
        InvalidRequestException - if the Raw terms are not valid
      • renameIdentifier

        public abstract Relation renameIdentifier​(ColumnIdentifier from,
                                                  ColumnIdentifier to)
        Renames an identifier in this Relation, if applicable.
        Parameters:
        from - the old identifier
        to - the new identifier
        Returns:
        this object, if the old identifier is not in the set of entities that this relation covers; otherwise a new Relation with "from" replaced by "to" is returned.
      • toCQLString

        public abstract java.lang.String toCQLString()
        Returns a CQL representation of this relation.
        Returns:
        a CQL representation of this relation
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object