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> 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.booleanstatic RuleCreates aRuleinstance from the given Node information.static RulefromNode(Node node, EndpointComponentFactory factory) Creates aRuleinstance from the given Node, resolving any functions in conditions using the givenEndpointComponentFactory.Gets the conditions required to satisfy this rule.Gets the documentation value.Gets the source location of a value.inthashCode()toNode()Converts a value to aNode.toString()Checks whether the given types within a scope satisfy the constraints.protected abstract TypetypecheckValue(Scope<Type> scope) final RulewithConditions(List<Condition> conditions) Get a new Rule of the same type that has the same values, but with the given conditions.protected abstract voidwithValueNode(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 aRuleinstance.- Returns:
- returns a new Builder.
-
builder
Builder to create aRuleinstance.- Parameters:
sourceLocation- the source of the rule.- Returns:
- returns a new Builder.
-
fromNode
Creates aRuleinstance from the given Node information.- Parameters:
node- the node to deserialize.- Returns:
- the created Rule.
-
fromNode
Creates aRuleinstance from the given Node, resolving any functions in conditions using the givenEndpointComponentFactory. Whenfactoryisnull, the default statically-discovered function factory is used.- Parameters:
node- the node to deserialize.factory- the factory used to resolve functions, or null.- Returns:
- the created Rule.
-
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
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 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.
-
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:TypeCheckChecks whether the given types within a scope satisfy the constraints. -
toNode
Description copied from interface:ToNodeConverts a value to aNode. -
equals
-
hashCode
public int hashCode() -
toString
-