Class Declaration
java.lang.Object
org.apache.commons.digester3.plugins.Declaration
Represents a Class that can be instantiated by a PluginCreateRule, plus info on how to load custom digester rules for
mapping xml into that plugged-in class.
- Since:
- 1.6
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private boolean
private Class
<?> The class of the object to be instantiated.private String
The name of the class of the object to be instantiated.private Properties
private RuleLoader
Class which is responsible for dynamically loading this plugin's rules on demand. -
Constructor Summary
ConstructorsConstructorDescriptionDeclaration
(Class<?> pluginClass) Constructor.Declaration
(Class<?> pluginClass, RuleLoader ruleLoader) Create an instance where a fully-initialised ruleLoader instance is provided by the caller instead of having the PluginManager "discover" an appropriate one.Declaration
(String pluginClassName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Attempt to load custom rules for the target class at the specified pattern.getId()
Return the id associated with this declaration.Class
<?> Return plugin class associated with this declaration.void
init
(Digester digester, PluginManager pm) Must be called exactly once, and must be called before any call to the configure method.void
The id that the user associated with a particular plugin declaration in the input xml.void
Copy all (key,value) pairs in the param into the properties member of this object.
-
Field Details
-
pluginClass
The class of the object to be instantiated. -
pluginClassName
The name of the class of the object to be instantiated. -
id
-
properties
-
initialized
private boolean initialized -
ruleLoader
Class which is responsible for dynamically loading this plugin's rules on demand.
-
-
Constructor Details
-
Declaration
Constructor.- Parameters:
pluginClassName
- The name of the class of the object to be instantiated (will be load in the init method)
-
Declaration
Constructor.- Parameters:
pluginClass
- The class of the object to be instantiated (will be load in the init method)
-
Declaration
Create an instance where a fully-initialised ruleLoader instance is provided by the caller instead of having the PluginManager "discover" an appropriate one.- Parameters:
pluginClass
- The class of the object to be instantiated (will be load in the init method)ruleLoader
- Class which is responsible for dynamically loading this plugin's rules on demand
-
-
Method Details
-
setId
The id that the user associated with a particular plugin declaration in the input xml. This id is later used in the input xml to refer back to the original declaration.For plugins declared "in-line", the id is null.
- Parameters:
id
- The id that the user associated with a particular plugin declaration in the input xml
-
getId
Return the id associated with this declaration. For plugins declared "inline", null will be returned.- Returns:
- The id value. May be null.
-
setProperties
Copy all (key,value) pairs in the param into the properties member of this object.The declaration properties cannot be explicit member variables, because the set of useful properties a user can provide on a declaration depends on what RuleFinder classes are available - and extra RuleFinders can be added by the user. So here we keep a map of the settings, and let the RuleFinder objects look for whatever properties they consider significant.
The "id" and "class" properties are treated differently.
- Parameters:
p
- The properties have to be copied into the properties member of this object
-
getPluginClass
Return plugin class associated with this declaration.- Returns:
- The pluginClass.
-
init
Must be called exactly once, and must be called before any call to the configure method.- Parameters:
digester
- The Digester instance where plugin has to be pluggedpm
- The plugin manager reference- Throws:
PluginException
- if any error occurs while loading the rules
-
configure
Attempt to load custom rules for the target class at the specified pattern.On return, any custom rules associated with the plugin class have been loaded into the Rules object currently associated with the specified digester object.
- Parameters:
digester
- The Digester instance where plugin has to be pluggedpattern
- The pattern the custom rules have to be bound- Throws:
PluginException
- if any error occurs
-