Interface FunctionParameter
-
public interface FunctionParameterGeneric, loose definition of a function parameter, able to infer the specific data type of the parameter in the function specifically built by aFunctionFactoryfor a particular function call.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static FunctionParameteranyCollection()static FunctionParameteranyMap()static FunctionParameteranyType(boolean inferFromReceiver)static FunctionParameterfixed(CQL3Type... types)default AbstractType<?>inferType(java.lang.String keyspace, AssignmentTestable arg, AbstractType<?> receiverType, java.util.List<AbstractType<?>> inferredTypes)Tries to infer the data type of the parameter for an argument in a call to the function.default booleanisOptional()static FunctionParameternumericSetOrList()static FunctionParameteroptional(FunctionParameter wrapped)static FunctionParametersameAs(int index, boolean preferOther, FunctionParameter parameter)static FunctionParametersetOrList()static FunctionParameterstring()voidvalidateType(FunctionName name, AssignmentTestable arg, AbstractType<?> argType)static FunctionParametervector(CQL3Type type)
-
-
-
Method Detail
-
inferType
@Nullable default AbstractType<?> inferType(java.lang.String keyspace, AssignmentTestable arg, @Nullable AbstractType<?> receiverType, @Nullable java.util.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 keyspacearg- a parameter value in a specific function callreceiverType- the type of the object that will receive the result of the function callinferredTypes- 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 withpreferOther- whether the parameter should prefer the type of the other parameter over its own typeparameter- 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()
-
numericSetOrList
static FunctionParameter numericSetOrList()
-
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
VectorTypewith elements of the specifiedtypeand any dimensions.
-
-