org.apache.commons.digester.plugins.strategies
public class FinderSetProperties extends RuleFinder
This allows ordinary JavaBean classes to be used as plugins, and have xml attributes be mapped to bean properties of the same name, without any custom plugin rules being created for them.
This RuleFinder is typically used as the last RuleFinder, so that automatic property setting only occurs if there is no other source of custom rules available.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DFLT_FALSEVAL |
static java.lang.String |
DFLT_PROPS_ATTR |
private java.lang.String |
falseval |
private java.lang.String |
propsAttr |
Constructor and Description |
---|
FinderSetProperties()
|
FinderSetProperties(java.lang.String propsAttr,
java.lang.String falseval)
Create a rule-finder which will arrange for a SetPropertiesRule to
be defined for each instance of a plugin, so that xml attributes
map to bean properties.
|
Modifier and Type | Method and Description |
---|---|
RuleLoader |
findLoader(Digester d,
java.lang.Class pluginClass,
java.util.Properties p)
Returns a RuleLoader unless the properties contain an entry
with the name matching constructor param propsAttr, and the value
matching what is in falseval.
|
public static java.lang.String DFLT_PROPS_ATTR
public static java.lang.String DFLT_FALSEVAL
private java.lang.String propsAttr
private java.lang.String falseval
public FinderSetProperties()
public FinderSetProperties(java.lang.String propsAttr, java.lang.String falseval)
Param falseval will commonly be the string "false" for config files written in English.
propsAttr
- must be non-null.falseval
- must be non-null.public RuleLoader findLoader(Digester d, java.lang.Class pluginClass, java.util.Properties p)
If no custom source of rules for a plugin is found, then the user almost always wants xml attributes to map to java bean properties, so this is the default behaviour unless the user explicitly indicates that they do not want a SetPropertiesRule to be provided for the plugged-in class.
The returned object (when non-null) will add a SetPropertiesRule to the digester whenever its addRules method is invoked.
findLoader
in class RuleFinder
Copyright 2001-2005 The Apache Software Foundation.