public interface DialogRewriteRule
Modifier and Type | Method and Description |
---|---|
Node |
applyTo(Node root,
java.util.Set<Node> finalNodes)
Applies this rule to the subtree rooted at the specified
root node. |
int |
getRanking()
Returns the ranking of this rule.
|
boolean |
matches(Node root)
Returns true if this rule matches the given subtree.
|
boolean matches(Node root) throws RepositoryException
root
- The root of the subtree to be checked for a matchRepositoryException
Node applyTo(Node root, java.util.Set<Node> finalNodes) throws DialogRewriteException, RepositoryException
Applies this rule to the subtree rooted at the specified root
node. The implementation of this
method may either modify the properties and nodes contained in that tree, or replace it by adding a new child
to the parent of root
. In the latter case, the implementation is responsible for removing the
original subtree (without saving).
Rewrite rules must not rewrite trees in a circular fashion, as this might lead to infinite loops.
Optionally, the implementation can indicate which nodes of the resulting tree are final and therefore safe for the algorithm to skip in subsequent traversals of the tree. Add the paths of final nodes to the specified set.
DialogRewriteUtils
provides utility methods that can
be used to temporarily rename (move) the original subtree, so that the resulting subtree can be built
while still having the original around.
root
- The root of the subtree to be rewrittenDialogRewriteException
- if the rewrite operation failed or cannot be completedRepositoryException
int getRanking()
Integer.MAX_VALUE
. The order of rules with equal rankings is arbitrary.Copyright © 2011-2015 Adobe Systems Incorporated. All Rights Reserved.