Class FunctionNode
java.lang.Object
software.amazon.smithy.rulesengine.language.syntax.expressions.functions.FunctionNode
- All Implemented Interfaces:
FromSourceLocation
,ToNode
,ToSmithyBuilder<FunctionNode>
public final class FunctionNode
extends Object
implements FromSourceLocation, ToNode, ToSmithyBuilder<FunctionNode>
Parsed but not validated function contents containing the `fn` name and `argv`.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A builder used to create aFunctionNode
class. -
Method Summary
Modifier and TypeMethodDescriptionstatic FunctionNode.Builder
builder()
Returns a new builder instance.Returns an expression representing this function.boolean
static FunctionNode
fromNode
(ObjectNode function) Constructs aFunctionNode
from the providedObjectNode
.Gets the list of argumentExpression
s to the function described in this node.getName()
Gets the name for the function described in this node.Gets the source location of a value.int
hashCode()
static FunctionNode
ofExpressions
(String functionName, FromSourceLocation sourceLocation, ToExpression... arguments) Constructs aFunctionNode
for the given function name and arguments.static FunctionNode
ofExpressions
(String functionName, ToExpression... arguments) Constructs aFunctionNode
for the given function name and arguments.Returns a new builder instance for thisFunctionNode
.toNode()
Converts a value to aNode
.
-
Method Details
-
ofExpressions
Constructs aFunctionNode
for the given function name and arguments.- Parameters:
functionName
- the function name.arguments
- zero or more expressions as arguments to the function.- Returns:
- the
FunctionNode
.
-
ofExpressions
public static FunctionNode ofExpressions(String functionName, FromSourceLocation sourceLocation, ToExpression... arguments) Constructs aFunctionNode
for the given function name and arguments.- Parameters:
functionName
- the function name.sourceLocation
- the source location for the function.arguments
- zero or more expressions as arguments to the function.- Returns:
- the
FunctionNode
.
-
builder
Returns a new builder instance.- Returns:
- the new builder instance.
-
fromNode
Constructs aFunctionNode
from the providedObjectNode
.- Parameters:
function
- the node describing the function.- Returns:
- the
FunctionNode
.
-
createFunction
Returns an expression representing this function.- Returns:
- this function as an expression.
-
getName
Gets the name for the function described in this node.- Returns:
- the name for the function.
-
getArguments
Gets the list of argumentExpression
s to the function described in this node.- Returns:
- the list of arguments.
-
getSourceLocation
Description copied from interface:FromSourceLocation
Gets the source location of a value.- Specified by:
getSourceLocation
in interfaceFromSourceLocation
- Returns:
- Returns the source location of the value.
-
toBuilder
Returns a new builder instance for thisFunctionNode
.- Specified by:
toBuilder
in interfaceToSmithyBuilder<FunctionNode>
- Returns:
- the new builder instance.
-
toNode
Description copied from interface:ToNode
Converts a value to aNode
. -
equals
-
hashCode
public int hashCode()
-