Class Rule
java.lang.Object
software.amazon.smithy.rulesengine.language.syntax.rule.Rule
- All Implemented Interfaces:
FromSourceLocation
,ToNode
,TypeCheck
- Direct Known Subclasses:
EndpointRule
,ErrorRule
,NoMatchRule
,TreeRule
The core functionality of a rule-set rule.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T> T
accept
(RuleValueVisitor<T> visitor) Invoke theRuleValueVisitor
functions for this Rule.static Rule.Builder
builder()
Builder to create aRule
instance.static Rule.Builder
builder
(FromSourceLocation sourceLocation) Builder to create aRule
instance.boolean
static Rule
Creates aRule
instance from the given Node information.Gets the conditions required to satisfy this rule.Gets the documentation value.Gets the source location of a value.int
hashCode()
toNode()
Converts a value to aNode
.toString()
Checks whether the given types within a scope satisfy the constraints.protected abstract Type
typecheckValue
(Scope<Type> scope) final Rule
withConditions
(List<Condition> conditions) Get a new Rule of the same type that has the same values, but with the given conditions.protected abstract void
withValueNode
(ObjectNode.Builder builder)
-
Field Details
-
DOCUMENTATION
- See Also:
-
ENDPOINT
- See Also:
-
ERROR
- See Also:
-
TREE
- See Also:
-
RULES
- See Also:
-
TYPE
- See Also:
-
-
Constructor Details
-
Rule
-
-
Method Details
-
builder
Builder to create aRule
instance.- Returns:
- returns a new Builder.
-
builder
Builder to create aRule
instance.- Parameters:
sourceLocation
- the source of the rule.- Returns:
- returns a new Builder.
-
fromNode
Creates aRule
instance from the given Node information.- Parameters:
node
- the node to deserialize.- Returns:
- the created Rule.
-
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.
-
getConditions
Gets the conditions required to satisfy this rule.- Returns:
- the list of conditions.
-
getDocumentation
Gets the documentation value.- Returns:
- returns the optional documentation value.
-
accept
Invoke theRuleValueVisitor
functions for this Rule.- Type Parameters:
T
- the visitor return type.- Parameters:
visitor
- the visitor to be invoked.- Returns:
- the return value of the visitor.
-
withConditions
Get a new Rule of the same type that has the same values, but with the given conditions.- Parameters:
conditions
- Conditions to use.- Returns:
- the rule with the given conditions.
- Throws:
UnsupportedOperationException
- if it is a TreeRule or Condition rule.
-
typecheckValue
-
withValueNode
-
typeCheck
Description copied from interface:TypeCheck
Checks whether the given types within a scope satisfy the constraints. -
toNode
Description copied from interface:ToNode
Converts a value to aNode
. -
equals
-
hashCode
public int hashCode() -
toString
-