Class Condition
- java.lang.Object
-
- software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
-
- software.amazon.smithy.rulesengine.language.syntax.rule.Condition
-
- All Implemented Interfaces:
FromSourceLocation,ToNode,TypeCheck,ToCondition,ToExpression
public final class Condition extends SyntaxElement implements TypeCheck, FromSourceLocation, ToNode
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.BuilderA builder used to create aConditionclass.
-
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 static Condition.Builderbuilder()Builder to create aConditioninstance.booleanequals(java.lang.Object o)static ConditionfromNode(Node node)Constructs a condition from the given node.ExpressiongetFunction()Gets the function used to express this condition.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()Condition.BuildertoBuilder()ConditiontoCondition()Convert this into a condition.Condition.BuildertoConditionBuilder()Convert this into a condition builder for compositional use.ExpressiontoExpression()Convert this into an expression.NodetoNode()Converts a value to aNode.java.lang.StringtoString()TypetypeCheck(Scope<Type> scope)Checks whether the given types within a scope satisfy the constraints.-
Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
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
-
-
-
-
Field Detail
-
ASSIGN
public static final java.lang.String ASSIGN
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static Condition.Builder builder()
Builder to create aConditioninstance.- Returns:
- returns a new Builder.
-
fromNode
public static Condition fromNode(Node node)
Constructs a condition from the given node.- Parameters:
node- the node.- Returns:
- the condition instance.
-
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.
-
getFunction
public Expression getFunction()
Gets the function used to express this condition.- Returns:
- the function for this condition.
-
toConditionBuilder
public Condition.Builder toConditionBuilder()
Description copied from interface:ToConditionConvert this into a condition builder for compositional use.- Specified by:
toConditionBuilderin interfaceToCondition- Returns:
- the condition builder.
-
toCondition
public Condition toCondition()
Description copied from interface:ToConditionConvert this into a condition.- Specified by:
toConditionin interfaceToCondition- Returns:
- the condition.
-
toExpression
public Expression toExpression()
Description copied from interface:ToExpressionConvert this into an expression.- Specified by:
toExpressionin interfaceToExpression- Returns:
- the expression.
-
toBuilder
public Condition.Builder toBuilder()
-
typeCheck
public Type typeCheck(Scope<Type> scope)
Description copied from interface:TypeCheckChecks whether the given types within a scope satisfy the constraints.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-