Class Condition
- java.lang.Object
-
- software.amazon.smithy.rulesengine.language.syntax.rule.Condition
-
- All Implemented Interfaces:
FromSourceLocation,ToNode,Into<Condition>,IntoSelf<Condition>,TypeCheck
public final class Condition extends java.lang.Object implements TypeCheck, FromSourceLocation, ToNode, IntoSelf<Condition>
A condition is call to a rule-set function that used to determine whether a rule should be executed. Can assign the results of functions to new parameters within the current scope.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCondition.Builder
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringASSIGN
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static ConditionfromNode(Node node)Constructs a condition from the given node.ExpressiongetFn()java.util.Optional<Identifier>getResult()Get the identifier of the parameter that the result is assigned to.SourceLocationgetSourceLocation()Gets the source location of a value.inthashCode()ExpressiontoExpression()Converts this condition to an expression reference if the condition has a result assignment.NodetoNode()Converts a value to aNode.java.lang.StringtoString()TypetypeCheck(Scope<Type> scope)
-
-
-
Field Detail
-
ASSIGN
public static final java.lang.String ASSIGN
- See Also:
- Constant Field Values
-
-
Method Detail
-
fromNode
public static Condition fromNode(Node node)
Constructs a condition from the given node.- Parameters:
node- the node.- Returns:
- the condition instance.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getFn
public Expression getFn()
-
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.
-
getResult
public java.util.Optional<Identifier> getResult()
Get the identifier of the parameter that the result is assigned to.- Returns:
- the optional identifier.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toExpression
public Expression toExpression()
Converts this condition to an expression reference if the condition has a result assignment. Otherwise throws an exception.- Returns:
- the result as a reference expression.
-
-