Interface Selectable

All Superinterfaces:
AssignmentTestable
All Known Implementing Classes:
ColumnMetadata, Selectable.BetweenParenthesesOrWithTuple, Selectable.WithArrayLiteral, Selectable.WithCast, Selectable.WithElementSelection, Selectable.WithFieldSelection, Selectable.WithFunction, Selectable.WithList, Selectable.WithMapOrUdt, Selectable.WithSet, Selectable.WithSliceSelection, Selectable.WithTerm, Selectable.WithTypeHint, Selectable.WithVector, Selectable.WritetimeOrTTL

public interface Selectable extends AssignmentTestable
  • Method Details

    • newSelectorFactory

      Selector.Factory newSelectorFactory(TableMetadata table, AbstractType<?> expectedType, List<ColumnMetadata> defs, VariableSpecifications boundNames)
    • getExactTypeIfKnown

      AbstractType<?> getExactTypeIfKnown(String keyspace)
      The type of the Selectable if it can be infered.
      Parameters:
      keyspace - the keyspace on which the statement for which this is a Selectable is on.
      Returns:
      the type of this Selectable if inferrable, or null otherwise (for instance, the type isn't inferable 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 return null too).
    • selectColumns

      boolean selectColumns(Predicate<ColumnMetadata> predicate)
      Checks if this Selectable select columns matching the specified predicate.
      Returns:
      true if this Selectable select columns matching the specified predicate, false otherwise.
    • selectColumns

      static boolean selectColumns(List<Selectable> selectables, Predicate<ColumnMetadata> predicate)
      Checks if the specified Selectables select columns matching the specified predicate.
      Parameters:
      selectables - the selectables to check.
      Returns:
      true if the specified Selectables select columns matching the specified predicate, false otherwise.
    • processesSelection

      default boolean processesSelection()
      Checks if any processing is performed on the selected columns, false otherwise.
      Returns:
      true if any processing is performed on the selected columns, false otherwise.
    • testAssignment

      default AssignmentTestable.TestResult testAssignment(String keyspace, ColumnSpecification receiver)
      Specified by:
      testAssignment in interface AssignmentTestable
      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.
    • getCompatibleTypeIfKnown

      default AbstractType<?> getCompatibleTypeIfKnown(String keyspace)
      Specified by:
      getCompatibleTypeIfKnown in interface AssignmentTestable
      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.
    • addAndGetIndex

      default int addAndGetIndex(ColumnMetadata def, List<ColumnMetadata> l)
    • specForElementOrSlice

      default ColumnSpecification specForElementOrSlice(Selectable selected, ColumnSpecification receiver, CollectionType.Kind kind, String selectionType)