Class ObjectOfInputTypeStrategy

  • All Implemented Interfaces:
    InputTypeStrategy

    @Internal
    public class ObjectOfInputTypeStrategy
    extends Object
    implements InputTypeStrategy
    Input type strategy for the OBJECT_OF function that validates argument types and counts.

    This strategy validates the input arguments for the OBJECT_OF function, ensuring:

    • The argument count is odd (className + pairs of key-value arguments)
    • The first argument is a non-null STRING/VARCHAR representing the class name
    • All key arguments (odd positions after the first) are non-null STRING/VARCHAR types
    • Field names are unique across all key-value pairs
    • Value arguments (even positions after the first) can be any type

    The expected function signature is: OBJECT_OF(className, key1, value1, key2, value2, ...)

    Example valid calls:

    • OBJECT_OF('com.example.User') - empty object
    • OBJECT_OF('com.example.User', 'name', 'Alice') - single field
    • OBJECT_OF('com.example.User', 'name', 'Alice', 'age', 30) - multiple fields
    See Also:
    BuiltInFunctionDefinitions.OBJECT_OF, ObjectOfTypeStrategy
    • Constructor Detail

      • ObjectOfInputTypeStrategy

        public ObjectOfInputTypeStrategy()
    • Method Detail

      • inferInputTypes

        public Optional<List<DataType>> inferInputTypes​(CallContext callContext,
                                                        boolean throwOnFailure)
        Description copied from interface: InputTypeStrategy
        Main logic for inferring and validating the input arguments. Returns a list of argument data types that are valid for the given call. If the returned types differ from CallContext.getArgumentDataTypes(), a casting operation can be inserted. An empty result means that the given input is invalid.
        Specified by:
        inferInputTypes in interface InputTypeStrategy
        Parameters:
        callContext - provides details about the function call
        throwOnFailure - whether this function is allowed to throw an ValidationException with a meaningful exception in case the inference is not successful or if this function should simply return an empty result.
        Returns:
        three-state result for either "true, same data types as arguments", "true, but arguments must be casted to returned data types", or "false, no inferred data types could be found"
        See Also:
        CallContext.newValidationError(String, Object...)