java.lang.Object
software.amazon.smithy.rulesengine.language.syntax.expressions.functions.Coalesce.Definition
All Implemented Interfaces:
FunctionDefinition
Enclosing class:
Coalesce

public static final class Coalesce.Definition extends Object implements FunctionDefinition
A FunctionDefinition for the Coalesce function.
  • Method Details

    • getId

      public String getId()
      Description copied from interface: FunctionDefinition
      The ID of this function.
      Specified by:
      getId in interface FunctionDefinition
      Returns:
      The ID string
    • getCost

      public int getCost()
      Description copied from interface: FunctionDefinition
      Returns the relative cost of evaluating this function.

      Lower values indicate cheaper operations. This cost is used by BDD optimizations to prefer evaluating cheaper conditions earlier, enabling short-circuit evaluation to skip expensive operations when possible.

      Specified by:
      getCost in interface FunctionDefinition
      Returns:
      the relative evaluation cost (default: 100)
    • getArguments

      public List<Type> getArguments()
      Description copied from interface: FunctionDefinition
      The arguments to this function.
      Specified by:
      getArguments in interface FunctionDefinition
      Returns:
      The function arguments
    • getVariadicArguments

      public Optional<Type> getVariadicArguments()
      Description copied from interface: FunctionDefinition
      Gets the type of variadic arguments if this function accepts them.

      When present, the function accepts any number of additional arguments of this type after the fixed arguments from getArguments().

      Specified by:
      getVariadicArguments in interface FunctionDefinition
      Returns:
      the variadic argument type, or empty if not variadic
    • getReturnType

      public Type getReturnType()
      Description copied from interface: FunctionDefinition
      The return type of this function definition.
      Specified by:
      getReturnType in interface FunctionDefinition
      Returns:
      The function return type
    • evaluate

      public Value evaluate(List<Value> arguments)
      Description copied from interface: FunctionDefinition
      Evaluate the arguments to a given function to compute a result.
      Specified by:
      evaluate in interface FunctionDefinition
      Returns:
      The resulting value
    • createFunction

      public Coalesce createFunction(FunctionNode functionNode)
      Description copied from interface: FunctionDefinition
      Creates a LibraryFunction implementation from the given FunctionNode.
      Specified by:
      createFunction in interface FunctionDefinition
      Parameters:
      functionNode - the function node to deserialize.
      Returns:
      the created LibraryFunction implementation.