Class Rule
- java.lang.Object
-
- software.amazon.smithy.rulesengine.language.syntax.rule.Rule
-
- All Implemented Interfaces:
FromSourceLocation,ToNode,TypeCheck
- Direct Known Subclasses:
EndpointRule,ErrorRule,TreeRule
public abstract class Rule extends java.lang.Object implements TypeCheck, ToNode, FromSourceLocation
The core functionality of a rule-set rule.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRule.BuilderA builder used to create aRuleclass.
-
Constructor Summary
Constructors Modifier Constructor Description protectedRule(Rule.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <T> Taccept(RuleValueVisitor<T> visitor)Invoke theRuleValueVisitorfunctions for this Rule.static Rule.Builderbuilder()Builder to create aRuleinstance.static Rule.Builderbuilder(FromSourceLocation sourceLocation)Builder to create aRuleinstance.booleanequals(java.lang.Object o)static RulefromNode(Node node)Creates aRuleinstance from the given Node information.java.util.List<Condition>getConditions()Gets the conditions required to satisfy this rule.java.util.Optional<java.lang.String>getDocumentation()Gets the documentation value.SourceLocationgetSourceLocation()Gets the source location of a value.inthashCode()NodetoNode()Converts a value to aNode.java.lang.StringtoString()TypetypeCheck(Scope<Type> scope)Checks whether the given types within a scope satisfy the constraints.protected abstract TypetypecheckValue(Scope<Type> scope)
-
-
-
Field Detail
-
DOCUMENTATION
public static final java.lang.String DOCUMENTATION
- See Also:
- Constant Field Values
-
ENDPOINT
public static final java.lang.String ENDPOINT
- See Also:
- Constant Field Values
-
ERROR
public static final java.lang.String ERROR
- See Also:
- Constant Field Values
-
TREE
public static final java.lang.String TREE
- See Also:
- Constant Field Values
-
RULES
public static final java.lang.String RULES
- See Also:
- Constant Field Values
-
TYPE
public static final java.lang.String TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Rule
protected Rule(Rule.Builder builder)
-
-
Method Detail
-
builder
public static Rule.Builder builder()
Builder to create aRuleinstance.- Returns:
- returns a new Builder.
-
builder
public static Rule.Builder builder(FromSourceLocation sourceLocation)
Builder to create aRuleinstance.- Parameters:
sourceLocation- the source of the rule.- Returns:
- returns a new Builder.
-
fromNode
public static Rule fromNode(Node node)
Creates aRuleinstance from the given Node information.- Parameters:
node- the node to deserialize.- Returns:
- the created Rule.
-
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.
-
getConditions
public java.util.List<Condition> getConditions()
Gets the conditions required to satisfy this rule.- Returns:
- the list of conditions.
-
getDocumentation
public java.util.Optional<java.lang.String> getDocumentation()
Gets the documentation value.- Returns:
- returns the optional documentation value.
-
accept
public abstract <T> T accept(RuleValueVisitor<T> visitor)
Invoke theRuleValueVisitorfunctions for this Rule.- Type Parameters:
T- the visitor return type.- Parameters:
visitor- the visitor to be invoked.- Returns:
- the return value of the visitor.
-
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
-
-