Interface FunctionParameter


public interface FunctionParameter
Generic, loose definition of a function parameter, able to infer the specific data type of the parameter in the function specifically built by a FunctionFactory for a particular function call.
  • Method Details

    • inferType

      @Nullable default AbstractType<?> inferType(String keyspace, AssignmentTestable arg, @Nullable AbstractType<?> receiverType, @Nullable List<AbstractType<?>> inferredTypes)
      Tries to infer the data type of the parameter for an argument in a call to the function.
      Parameters:
      keyspace - the current keyspace
      arg - a parameter value in a specific function call
      receiverType - the type of the object that will receive the result of the function call
      inferredTypes - the types that have been inferred for the other parameters
      Returns:
      the inferred data type of the parameter, or {@link null} it isn't possible to infer it
    • validateType

      void validateType(FunctionName name, AssignmentTestable arg, AbstractType<?> argType)
    • isOptional

      default boolean isOptional()
      Returns:
      whether this parameter is optional
    • optional

      static FunctionParameter optional(FunctionParameter wrapped)
      Parameters:
      wrapped - the wrapped parameter
      Returns:
      a function parameter definition that accepts the specified wrapped parameter, considering it optional as defined by isOptional().
    • string

      static FunctionParameter string()
      Returns:
      a function parameter definition that accepts values of string-based data types (text, varchar and ascii)
    • fixed

      static FunctionParameter fixed(CQL3Type... types)
      Parameters:
      types - the accepted data types
      Returns:
      a function parameter definition that accepts values of a specific data type
    • anyType

      static FunctionParameter anyType(boolean inferFromReceiver)
      Parameters:
      inferFromReceiver - whether the parameter should try to use the function receiver to infer its data type
      Returns:
      a function parameter definition that accepts columns of any data type
    • sameAs

      static FunctionParameter sameAs(int index, boolean preferOther, FunctionParameter parameter)
      Parameters:
      index - the index of the function argument that this parameter is associated with
      preferOther - whether the parameter should prefer the type of the other parameter over its own type
      parameter - the type of this parameter when the type of the associated parameter is unknown
      Returns:
      a function parameter definition that is expected to have the same type as another parameter
    • anyCollection

      static FunctionParameter anyCollection()
      Returns:
      a function parameter definition that accepts values of type CollectionType, independently of the types of its elements.
    • setOrList

      static FunctionParameter setOrList()
      Returns:
      a function parameter definition that accepts values of type SetType or ListType.
    • numericSetOrList

      static FunctionParameter numericSetOrList()
      Returns:
      a function parameter definition that accepts values of type SetType or ListType, provided that its elements are numeric.
    • anyMap

      static FunctionParameter anyMap()
      Returns:
      a function parameter definition that accepts values of type MapType, independently of the types of the map keys and values.
    • vector

      static FunctionParameter vector(CQL3Type type)
      Parameters:
      type - the type of the vector elements
      Returns:
      a function parameter definition that accepts values of type VectorType with elements of the specified type and any dimensions.