public abstract class Rule extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Rule() |
| Modifier and Type | Method and Description |
|---|---|
abstract Node |
apply(Node node)
Applies the rule to the node using the following criteria
- if rule does not match returns an ErrorNode and stops processing
- if rule matches, applies rules to children
- if rule contains a NodeFactory, returns the result of it
- else returns node
Only structure rules (
ObjectRule, ArrayRule, KeyValueRule) replace child nodes. |
Node |
createNodeUsingFactory(Node currentNode,
Object... args) |
abstract String |
getDescription() |
List<Suggestion> |
getSuggestions(List<Node> pathToRoot,
RamlParsingContext context)
Returns the list of suggestions after navigating through the path
|
abstract List<Suggestion> |
getSuggestions(Node node,
RamlParsingContext context)
Returns the suggestions of this specific rule
|
abstract boolean |
matches(Node node)
Check if the current rule matches the specified node
|
Rule |
then(Class<? extends Node> clazz) |
Rule |
then(NodeFactory factory) |
public abstract boolean matches(@Nonnull Node node)
node - The node to check with@Nonnull public abstract Node apply(@Nonnull Node node)
ObjectRule, ArrayRule, KeyValueRule) replace child nodes.node - The current nodepublic abstract String getDescription()
@Nonnull public Node createNodeUsingFactory(@Nonnull Node currentNode, Object... args)
public Rule then(NodeFactory factory)
public List<Suggestion> getSuggestions(List<Node> pathToRoot, RamlParsingContext context)
pathToRoot - The path of nodes to get of the node from where we want the suggestionscontext - The parse context@Nonnull public abstract List<Suggestion> getSuggestions(Node node, RamlParsingContext context)
node - The nodecontext - The parse contextCopyright © 2016. All rights reserved.