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.boolean
protected Expression
Get the function definition.getName()
Returns the name of this function, eg.Gets the source location of a value.int
hashCode()
protected static boolean
shouldSwapArgs
(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 Type
typeCheckLocal
(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, typeCheck
Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
availableSince, booleanEqual, getAttr, getAttr, isSet, isValidHostLabel, not, parseUrl, stringEqual, substring, template
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:Expression
Computes the references of an expression.- Overrides:
calculateReferences
in 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:ToCondition
Convert this into a condition builder for compositional use.- Returns:
- the condition builder.
-
getSourceLocation
Description copied from interface:FromSourceLocation
Gets the source location of a value.- Specified by:
getSourceLocation
in interfaceFromSourceLocation
- Overrides:
getSourceLocation
in classExpression
- Returns:
- Returns the source location of the value.
-
typeCheckLocal
- Specified by:
typeCheckLocal
in classExpression
-
toNode
Description copied from interface:ToNode
Converts a value to aNode
.- Returns:
- Returns the creates Node.
-
equals
- Specified by:
equals
in classExpression
-
hashCode
public int hashCode()- Specified by:
hashCode
in 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
-