All Implemented Interfaces:
FromSourceLocation, ToNode, TypeCheck, ToCondition, ToExpression
Direct Known Subclasses:
AwsPartition, BooleanEquals, Coalesce, GetAttr, IsSet, IsValidHostLabel, IsVirtualHostableS3Bucket, Not, ParseArn, ParseUrl, Split, StringEquals, Substring, UriEncode

public abstract class LibraryFunction extends Expression
A function which is constructed from a FunctionDefinition.
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Returns the name of this function, eg. isSet, parseUrl
      Returns:
      The name
    • calculateReferences

      protected Set<String> calculateReferences()
      Description copied from class: Expression
      Computes the references of an expression.
      Overrides:
      calculateReferences in class Expression
      Returns:
      the computed references.
    • getFunctionDefinition

      public FunctionDefinition getFunctionDefinition()
      Get the function definition.
      Returns:
      function definition.
    • getArguments

      public List<Expression> getArguments()
      Returns:
      The arguments to this function
    • canonicalize

      public LibraryFunction canonicalize()
      Returns a canonical form of this function.

      Default implementation returns this. Override for functions that need canonicalization.

      Returns:
      the canonical form of this function
    • expectOneArgument

      protected Expression expectOneArgument()
    • toConditionBuilder

      public Condition.Builder toConditionBuilder()
      Description copied from interface: ToCondition
      Convert this into a condition builder for compositional use.
      Returns:
      the condition builder.
    • getSourceLocation

      public SourceLocation getSourceLocation()
      Description copied from interface: FromSourceLocation
      Gets the source location of a value.
      Specified by:
      getSourceLocation in interface FromSourceLocation
      Overrides:
      getSourceLocation in class Expression
      Returns:
      Returns the source location of the value.
    • typeCheckLocal

      protected Type typeCheckLocal(Scope<Type> scope)
      Specified by:
      typeCheckLocal in class Expression
    • toNode

      public Node toNode()
      Description copied from interface: ToNode
      Converts a value to a Node.
      Returns:
      Returns the creates Node.
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in class Expression
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class Expression
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • shouldSwapArgs

      protected static boolean shouldSwapArgs(Expression arg0, Expression arg1)
      Determines if two arguments should be swapped for canonical ordering. Used by commutative functions to ensure consistent argument order.
      Parameters:
      arg0 - the first argument
      arg1 - the second argument
      Returns:
      true if arguments should be swapped