Class InputTypeStrategies
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AnyArgumentTypeStrategyStrategy for an argument that can be of any type.static final ArgumentTypeStrategyArgument type strategy that checks and casts for a common, least restrictive type of all arguments.static final ArgumentTypeStrategyArgument type strategy that checks and casts for a common, least restrictive type of all arguments.static final ArgumentTypeStrategyStrategy that checks that the argument has a composite type.static final ArgumentTypeStrategystatic final LiteralArgumentTypeStrategyStrategy that checks if an argument is a literal.static final LiteralArgumentTypeStrategyStrategy that checks if an argument is a literal or NULL.static final InputTypeStrategyStrategy that does not expect any arguments.static final OutputArgumentTypeStrategyStrategy for inferring an unknown argument type from the function's outputDataTypeif available.static final TypeLiteralArgumentTypeStrategyStrategy that checks if an argument is a type literal.static final WildcardInputTypeStrategyStrategy that does not perform any modification or validation of the input. -
Method Summary
Modifier and TypeMethodDescriptionstatic AndArgumentTypeStrategyand(ArgumentTypeStrategy... strategies) Strategy for a conjunction of multipleArgumentTypeStrategys into one likef(NUMERIC && LITERAL).static InputTypeStrategycommonArrayType(int count) AnInputTypeStrategythat expectscountarguments that have a common array type.static InputTypeStrategycommonMapType(int minCount) AnInputTypeStrategythat expectsminCountarguments that have a common map type.static InputTypeStrategycommonMultipleArrayType(int minCount) AnInputTypeStrategythat expectsminCountarguments that have a common array type.static InputTypeStrategycommonType(int count) AnInputTypeStrategythat expectscountarguments that have a common type.static InputTypeStrategycomparable(ConstantArgumentCount argumentCount, StructuredType.StructuredComparison requiredComparison) Strategy that checks all types are comparable with each other.An strategy that lets you apply other strategies for subsequences of the actual arguments.constraint(String constraintMessage, Predicate<List<DataType>> evaluator) Strategy for an argument that must fulfill a given constraint.static ExplicitArgumentTypeStrategyStrategy for an argument that corresponds to an explicitly defined type casting.static InputTypeStrategyexplicitSequence(String[] argumentNames, DataType[] expectedDataTypes) Strategy for a named function signature of explicitly defined types likef(s STRING, i INT).static InputTypeStrategyexplicitSequence(DataType... expectedDataTypes) Strategy for a function signature of explicitly defined types likef(STRING, INT).static FamilyArgumentTypeStrategylogical(LogicalTypeFamily expectedFamily) Strategy for an argument that corresponds to a givenLogicalTypeFamily.static FamilyArgumentTypeStrategylogical(LogicalTypeFamily expectedFamily, boolean expectedNullability) Strategy for an argument that corresponds to a givenLogicalTypeFamilyand nullability.static RootArgumentTypeStrategylogical(LogicalTypeRoot expectedRoot) Strategy for an argument that corresponds to a givenLogicalTypeRoot.static RootArgumentTypeStrategylogical(LogicalTypeRoot expectedRoot, boolean expectedNullability) Strategy for an argument that corresponds to a givenLogicalTypeRootand nullability.static OrArgumentTypeStrategyor(ArgumentTypeStrategy... strategies) Strategy for a disjunction of multipleArgumentTypeStrategys into one likef(NUMERIC || STRING).static InputTypeStrategyor(InputTypeStrategy... strategies) Strategy for a disjunction of multipleInputTypeStrategys into one likef(NUMERIC) || f(STRING).static InputTypeStrategyrepeatingSequence(ArgumentTypeStrategy... strategies) Arbitrarily often repeating sequence of argument type strategies.static InputTypeStrategysequence(String[] argumentNames, ArgumentTypeStrategy[] strategies) Strategy for a named function signature likef(s STRING, n NUMERIC)using a sequence ofArgumentTypeStrategys.static InputTypeStrategysequence(List<String> argumentNames, List<ArgumentTypeStrategy> strategies) Strategy for a named function signature likef(s STRING, n NUMERIC)using a sequence ofArgumentTypeStrategys.static InputTypeStrategysequence(ArgumentTypeStrategy... strategies) Strategy for a function signature likef(STRING, NUMERIC)using a sequence ofArgumentTypeStrategys.static SymbolArgumentTypeStrategy<?>symbol(Class<? extends Enum<? extends TableSymbol>> clazz) Strategy for a symbol argument of a specificTableSymbolenum.static <T extends Enum<? extends TableSymbol>>
SymbolArgumentTypeStrategy<T>symbol(T firstAllowedVariant, T... otherAllowedVariants) Strategy for a symbol argument of a specificTableSymbolenum, with value being one of the provided variants.static InputTypeStrategyvaryingSequence(String[] argumentNames, ArgumentTypeStrategy[] strategies) Strategy for a varying named function signature likef(i INT, str STRING, num NUMERIC...)using a sequence ofArgumentTypeStrategys.static InputTypeStrategyvaryingSequence(List<String> argumentNames, List<ArgumentTypeStrategy> strategies) Strategy for a varying named function signature likef(i INT, str STRING, num NUMERIC...)using a sequence ofArgumentTypeStrategys.static InputTypeStrategyvaryingSequence(ArgumentTypeStrategy... strategies) Strategy for a varying function signature likef(INT, STRING, NUMERIC...)using a sequence ofArgumentTypeStrategys.static InputTypeStrategywildcardWithCount(ArgumentCount argumentCount) Strategy that does not perform any modification or validation of the input.
-
Field Details
-
WILDCARD
Strategy that does not perform any modification or validation of the input. -
NO_ARGS
Strategy that does not expect any arguments. -
OUTPUT_IF_NULL
Strategy for inferring an unknown argument type from the function's outputDataTypeif available. -
ANY
Strategy for an argument that can be of any type. -
LITERAL
Strategy that checks if an argument is a literal. -
LITERAL_OR_NULL
Strategy that checks if an argument is a literal or NULL. -
TYPE_LITERAL
Strategy that checks if an argument is a type literal. -
COMPOSITE
Strategy that checks that the argument has a composite type. -
COMMON_ARG
Argument type strategy that checks and casts for a common, least restrictive type of all arguments. -
COMMON_ARG_NULLABLE
Argument type strategy that checks and casts for a common, least restrictive type of all arguments. But leaves nullability untouched. -
ITEM_AT_INDEX
- See Also:
-
-
Method Details
-
sequence
Strategy for a function signature likef(STRING, NUMERIC)using a sequence ofArgumentTypeStrategys. -
sequence
Strategy for a named function signature likef(s STRING, n NUMERIC)using a sequence ofArgumentTypeStrategys. -
sequence
public static InputTypeStrategy sequence(List<String> argumentNames, List<ArgumentTypeStrategy> strategies) Strategy for a named function signature likef(s STRING, n NUMERIC)using a sequence ofArgumentTypeStrategys. -
varyingSequence
Strategy for a varying function signature likef(INT, STRING, NUMERIC...)using a sequence ofArgumentTypeStrategys. The first n - 1 arguments must be constant. The n-th argument can occur 0, 1, or more times. -
varyingSequence
public static InputTypeStrategy varyingSequence(String[] argumentNames, ArgumentTypeStrategy[] strategies) Strategy for a varying named function signature likef(i INT, str STRING, num NUMERIC...)using a sequence ofArgumentTypeStrategys. The first n - 1 arguments must be constant. The n-th argument can occur 0, 1, or more times. -
varyingSequence
public static InputTypeStrategy varyingSequence(List<String> argumentNames, List<ArgumentTypeStrategy> strategies) Strategy for a varying named function signature likef(i INT, str STRING, num NUMERIC...)using a sequence ofArgumentTypeStrategys. The first n - 1 arguments must be constant. The n-th argument can occur 0, 1, or more times. -
repeatingSequence
Arbitrarily often repeating sequence of argument type strategies. -
explicitSequence
Strategy for a function signature of explicitly defined types likef(STRING, INT). Implicit casts will be inserted if possible.This is equivalent to using
sequence(ArgumentTypeStrategy...)andexplicit(DataType). -
explicitSequence
public static InputTypeStrategy explicitSequence(String[] argumentNames, DataType[] expectedDataTypes) Strategy for a named function signature of explicitly defined types likef(s STRING, i INT). Implicit casts will be inserted if possible.This is equivalent to using
sequence(String[], ArgumentTypeStrategy[])andexplicit(DataType). -
compositeSequence
An strategy that lets you apply other strategies for subsequences of the actual arguments.The
sequence(ArgumentTypeStrategy...)should be preferred in most of the cases. Use this strategy only if you need to apply a common logic to a subsequence of the arguments. -
or
Strategy for a disjunction of multipleInputTypeStrategys into one likef(NUMERIC) || f(STRING).This strategy aims to infer a list of types that are equal to the input types (to prevent unnecessary casting) or (if this is not possible) the first more specific, casted types.
-
wildcardWithCount
Strategy that does not perform any modification or validation of the input. It checks the argument count though. -
comparable
public static InputTypeStrategy comparable(ConstantArgumentCount argumentCount, StructuredType.StructuredComparison requiredComparison) Strategy that checks all types are comparable with each other. Requires at least one argument. -
explicit
Strategy for an argument that corresponds to an explicitly defined type casting. Implicit casts will be inserted if possible. -
logical
Strategy for an argument that corresponds to a givenLogicalTypeRoot. Implicit casts will be inserted if possible. -
logical
public static RootArgumentTypeStrategy logical(LogicalTypeRoot expectedRoot, boolean expectedNullability) Strategy for an argument that corresponds to a givenLogicalTypeRootand nullability. Implicit casts will be inserted if possible. -
logical
Strategy for an argument that corresponds to a givenLogicalTypeFamily. Implicit casts will be inserted if possible. -
logical
public static FamilyArgumentTypeStrategy logical(LogicalTypeFamily expectedFamily, boolean expectedNullability) Strategy for an argument that corresponds to a givenLogicalTypeFamilyand nullability. Implicit casts will be inserted if possible. -
constraint
public static ConstraintArgumentTypeStrategy constraint(String constraintMessage, Predicate<List<DataType>> evaluator) Strategy for an argument that must fulfill a given constraint. -
and
Strategy for a conjunction of multipleArgumentTypeStrategys into one likef(NUMERIC && LITERAL).Some
ArgumentTypeStrategys cannot contribute an inferred type that is different from the input type (e.g.LITERAL). Therefore, the orderf(X && Y)orf(Y && X)matters as it defines the precedence in case the result must be casted to a more specific type.This strategy aims to infer the first more specific, casted type or (if this is not possible) a type that has been inferred from all
ArgumentTypeStrategys. -
or
Strategy for a disjunction of multipleArgumentTypeStrategys into one likef(NUMERIC || STRING).Some
ArgumentTypeStrategys cannot contribute an inferred type that is different from the input type (e.g.LITERAL). Therefore, the orderf(X || Y)orf(Y || X)matters as it defines the precedence in case the result must be casted to a more specific type.This strategy aims to infer a type that is equal to the input type (to prevent unnecessary casting) or (if this is not possible) the first more specific, casted type.
-
symbol
public static SymbolArgumentTypeStrategy<?> symbol(Class<? extends Enum<? extends TableSymbol>> clazz) Strategy for a symbol argument of a specificTableSymbolenum.A symbol is implied to be a literal argument.
-
symbol
@SafeVarargs public static <T extends Enum<? extends TableSymbol>> SymbolArgumentTypeStrategy<T> symbol(T firstAllowedVariant, T... otherAllowedVariants) Strategy for a symbol argument of a specificTableSymbolenum, with value being one of the provided variants.A symbol is implied to be a literal argument.
-
commonType
AnInputTypeStrategythat expectscountarguments that have a common type. -
commonArrayType
AnInputTypeStrategythat expectscountarguments that have a common array type. -
commonMultipleArrayType
AnInputTypeStrategythat expectsminCountarguments that have a common array type. -
commonMapType
AnInputTypeStrategythat expectsminCountarguments that have a common map type.
-