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 classFunctionNode.BuilderA builder used to create aFunctionNodeclass.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FunctionNode.Builderbuilder()Returns a new builder instance.ExpressioncreateFunction()Returns an expression representing this function.booleanequals(java.lang.Object o)static FunctionNodefromNode(ObjectNode function)Constructs aFunctionNodefrom the providedObjectNode.java.util.List<Expression>getArguments()Gets the list of argumentExpressions to the function described in this node.java.lang.StringgetName()Gets the name for the function described in this node.SourceLocationgetSourceLocation()Gets the source location of a value.inthashCode()static FunctionNodeofExpressions(java.lang.String functionName, FromSourceLocation sourceLocation, ToExpression... arguments)Constructs aFunctionNodefor the given function name and arguments.static FunctionNodeofExpressions(java.lang.String functionName, ToExpression... arguments)Constructs aFunctionNodefor the given function name and arguments.FunctionNode.BuildertoBuilder()Returns a new builder instance for thisFunctionNode.NodetoNode()Converts a value to aNode.
-
-
-
Method Detail
-
ofExpressions
public static FunctionNode ofExpressions(java.lang.String functionName, ToExpression... arguments)
Constructs aFunctionNodefor 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 aFunctionNodefor 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 aFunctionNodefrom 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 argumentExpressions to the function described in this node.- Returns:
- the list of arguments.
-
getSourceLocation
public SourceLocation getSourceLocation()
Description copied from interface:FromSourceLocationGets the source location of a value.- Specified by:
getSourceLocationin interfaceFromSourceLocation- Returns:
- Returns the source location of the value.
-
toBuilder
public FunctionNode.Builder toBuilder()
Returns a new builder instance for thisFunctionNode.- Specified by:
toBuilderin interfaceToSmithyBuilder<FunctionNode>- Returns:
- the new builder instance.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-