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 java.lang.Object implements FromSourceLocation, ToNode, ToSmithyBuilder<FunctionNode>
Parsed but not validated function contents containing the `fn` name and `argv`.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FunctionNode.Builder
A builder used to create aFunctionNode
class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FunctionNode.Builder
builder()
Returns a new builder instance.Expression
createFunction()
Returns an expression representing this function.boolean
equals(java.lang.Object o)
static FunctionNode
fromNode(ObjectNode function)
Constructs aFunctionNode
from the providedObjectNode
.java.util.List<Expression>
getArguments()
Gets the list of argumentExpression
s to the function described in this node.java.lang.String
getName()
Gets the name for the function described in this node.SourceLocation
getSourceLocation()
Gets the source location of a value.int
hashCode()
static FunctionNode
ofExpressions(java.lang.String functionName, FromSourceLocation sourceLocation, ToExpression... arguments)
Constructs aFunctionNode
for the given function name and arguments.static FunctionNode
ofExpressions(java.lang.String functionName, ToExpression... arguments)
Constructs aFunctionNode
for the given function name and arguments.FunctionNode.Builder
toBuilder()
Returns a new builder instance for thisFunctionNode
.Node
toNode()
Converts a value to aNode
.
-
-
-
Method Detail
-
ofExpressions
public static FunctionNode ofExpressions(java.lang.String functionName, ToExpression... arguments)
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(java.lang.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
public static FunctionNode.Builder builder()
Returns a new builder instance.- Returns:
- the new builder instance.
-
fromNode
public static FunctionNode fromNode(ObjectNode function)
Constructs aFunctionNode
from the providedObjectNode
.- Parameters:
function
- the node describing the function.- Returns:
- the
FunctionNode
.
-
createFunction
public Expression createFunction()
Returns an expression representing this function.- Returns:
- this function as an expression.
-
getName
public java.lang.String getName()
Gets the name for the function described in this node.- Returns:
- the name for the function.
-
getArguments
public java.util.List<Expression> getArguments()
Gets the list of argumentExpression
s to the function described in this node.- Returns:
- the list of arguments.
-
getSourceLocation
public SourceLocation 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
public FunctionNode.Builder toBuilder()
Returns a new builder instance for thisFunctionNode
.- Specified by:
toBuilder
in interfaceToSmithyBuilder<FunctionNode>
- Returns:
- the new builder instance.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-