public static class JControlModel.MatchRule
extends java.lang.Object
During the merge, the current state of the nodes of a tree is applied to the nodes of another tree. Pairing the nodes of each tree is one of the main activities of the process.
A Match Rule allows a developer to replace the default matching algorithm, based on qualified names, to better suite the needs of an specific application. Some examples:
<merge:match markup="^gen$" get="Member/getName"/> <merge:match get="Method/getComment" signature="\s*@\s*uuid\s*(\S*)\s*\n"/>
The first match rule is applicable to any Member marked with the expression defined
by the "^gen$" Dictionary Pattern. It defines that these members are matched
by their names. The second rule is applicable to any method that has
@uuid xyz
on its comment. In this case, the string xyz
is be used to match the nodes.
An important remark is that if there is a type conversion during the merge process,
the match rules should not be used to pair different "kinds" of elements
like fields and enumerator constants for example. See
Jmerger.convert
and NodeConverter
for further details on conversions.
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
classPrefix |
protected JControlModel.Feature |
getFeature |
protected java.util.regex.Pattern |
markup |
protected java.lang.String |
name |
protected java.util.regex.Pattern |
signature |
protected boolean |
stopMatching |
Constructor and Description |
---|
JControlModel.MatchRule(java.lang.String classPrefix) |
JControlModel.MatchRule(java.lang.String classPrefix,
org.w3c.dom.Element element) |
Modifier and Type | Method and Description |
---|---|
protected JControlModel.Feature |
createFeature(java.lang.String classPrefix,
java.lang.String path,
java.lang.Class<?>[] parameterTypes) |
java.lang.String |
getClassPrefix() |
JControlModel.Feature |
getGetFeature() |
java.util.regex.Pattern |
getMarkup() |
java.lang.String |
getName() |
java.util.regex.Pattern |
getSignature() |
void |
initialize(org.w3c.dom.Element element) |
boolean |
isStopMatching() |
protected void |
setClassPrefix(java.lang.String classPrefix) |
void |
setGetFeature(JControlModel.Feature getFeature) |
void |
setMarkup(java.util.regex.Pattern markup) |
void |
setName(java.lang.String name) |
void |
setSignature(java.util.regex.Pattern signature) |
void |
setStopMatching(boolean stopMatching) |
protected java.lang.String name
protected java.util.regex.Pattern markup
protected JControlModel.Feature getFeature
protected java.util.regex.Pattern signature
protected boolean stopMatching
protected java.lang.String classPrefix
public JControlModel.MatchRule(java.lang.String classPrefix)
public JControlModel.MatchRule(java.lang.String classPrefix, org.w3c.dom.Element element)
public void initialize(org.w3c.dom.Element element)
protected JControlModel.Feature createFeature(java.lang.String classPrefix, java.lang.String path, java.lang.Class<?>[] parameterTypes)
public java.lang.String getName()
public void setName(java.lang.String name)
public JControlModel.Feature getGetFeature()
public void setGetFeature(JControlModel.Feature getFeature)
public java.util.regex.Pattern getMarkup()
public void setMarkup(java.util.regex.Pattern markup)
public java.util.regex.Pattern getSignature()
public void setSignature(java.util.regex.Pattern signature)
public boolean isStopMatching()
public void setStopMatching(boolean stopMatching)
protected void setClassPrefix(java.lang.String classPrefix)
public java.lang.String getClassPrefix()