class ConfigDefineRule
extends org.apache.commons.digester.Rule
Digester rule that will dynamically register a new set of rules
for a specified element name and default implementation class. This
allows "alias" elements to be created for Chain
and Command
implementation classes that are commonly used. Besides factoring out
the class names to make changes easier, this also makes configuration
files much easier to read and write.
Modifier and Type | Field | Description |
---|---|---|
private java.lang.String |
classAttribute |
The name of the attribute under which we can retrieve the
fully qualified class name of the implementation class for this
new element.
|
private java.lang.String |
nameAttribute |
The name of the attribute under which we can retrieve the name
this element for which rules should be created.
|
Constructor | Description |
---|---|
ConfigDefineRule(java.lang.String nameAttribute,
java.lang.String classAttribute) |
Construct a new instance of this rule that will in turn
dynamically register appropriate rules for a new alias element.
|
Modifier and Type | Method | Description |
---|---|---|
void |
begin(java.lang.String namespace,
java.lang.String name,
org.xml.sax.Attributes attributes) |
Register new rules for the specified name and class.
|
private java.lang.String classAttribute
The name of the attribute under which we can retrieve the fully qualified class name of the implementation class for this new element.
private java.lang.String nameAttribute
The name of the attribute under which we can retrieve the name this element for which rules should be created.
public ConfigDefineRule(java.lang.String nameAttribute, java.lang.String classAttribute)
Construct a new instance of this rule that will in turn dynamically register appropriate rules for a new alias element.
nameAttribute
- Name of the attribute containing the name
of the new element for which rules should generatedclassAttribute
- Name of the attribute containing the
implementation class for the new chain or commandpublic void begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes) throws java.lang.Exception
Register new rules for the specified name and class.
begin
in class org.apache.commons.digester.Rule
namespace
- the namespace URI of the matching element, or an
empty string if the parser is not namespace aware or the element has
no namespacename
- the local name if the parser is namespace aware, or just
the element name otherwiseattributes
- The attribute list of this elementjava.lang.Exception