Class LibraryFunction
java.lang.Object
software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
software.amazon.smithy.rulesengine.language.syntax.expressions.Expression
software.amazon.smithy.rulesengine.language.syntax.expressions.functions.LibraryFunction
- 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
A function which is constructed from a
FunctionDefinition.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes the references of an expression.Returns a canonical form of this function.booleanprotected ExpressionGet the function definition.getName()Returns the name of this function, eg.Gets the source location of a value.inthashCode()protected static booleanshouldSwapArgs(Expression arg0, Expression arg1) Determines if two arguments should be swapped for canonical ordering.Convert this into a condition builder for compositional use.toNode()Converts a value to aNode.toString()protected TypetypeCheckLocal(Scope<Type> scope) Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.expressions.Expression
accept, fromNode, getLiteral, getReference, getReference, getReference, getReferences, of, of, of, parseShortform, toExpression, type, typeCheckMethods inherited from class software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
availableSince, booleanEqual, getAttr, getAttr, isSet, isValidHostLabel, not, parseUrl, stringEqual, substring, templateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.smithy.rulesengine.language.syntax.ToCondition
toCondition, toCondition
-
Field Details
-
definition
-
functionNode
-
-
Constructor Details
-
LibraryFunction
-
-
Method Details
-
getName
Returns the name of this function, eg.isSet,parseUrl- Returns:
- The name
-
calculateReferences
Description copied from class:ExpressionComputes the references of an expression.- Overrides:
calculateReferencesin classExpression- Returns:
- the computed references.
-
getFunctionDefinition
Get the function definition.- Returns:
- function definition.
-
getArguments
- Returns:
- The arguments to this function
-
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
-
toConditionBuilder
Description copied from interface:ToConditionConvert this into a condition builder for compositional use.- Returns:
- the condition builder.
-
getSourceLocation
Description copied from interface:FromSourceLocationGets the source location of a value.- Specified by:
getSourceLocationin interfaceFromSourceLocation- Overrides:
getSourceLocationin classExpression- Returns:
- Returns the source location of the value.
-
typeCheckLocal
- Specified by:
typeCheckLocalin classExpression
-
toNode
Description copied from interface:ToNodeConverts a value to aNode.- Returns:
- Returns the creates Node.
-
equals
- Specified by:
equalsin classExpression
-
hashCode
public int hashCode()- Specified by:
hashCodein classExpression
-
toString
-
shouldSwapArgs
Determines if two arguments should be swapped for canonical ordering. Used by commutative functions to ensure consistent argument order.- Parameters:
arg0- the first argumentarg1- the second argument- Returns:
- true if arguments should be swapped
-