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 aFunctionFactory
for a particular function call.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static FunctionParameter
anyCollection()
static FunctionParameter
anyMap()
static FunctionParameter
anyType(boolean inferFromReceiver)
static FunctionParameter
fixed(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 boolean
isOptional()
static FunctionParameter
numericSetOrList()
static FunctionParameter
optional(FunctionParameter wrapped)
static FunctionParameter
sameAs(int index, boolean preferOther, FunctionParameter parameter)
static FunctionParameter
setOrList()
static FunctionParameter
string()
void
validateType(FunctionName name, AssignmentTestable arg, AbstractType<?> argType)
static FunctionParameter
vector(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
VectorType
with elements of the specifiedtype
and any dimensions.
-
-