public abstract class RuleFinder extends Object
Instances of this class can also be regarded as a Factory for RuleLoaders, except that an instance of a RuleLoader is only created if the particular finder algorithm can locate a suitable source of rules given the plugin class and associated properties.
This is an abstract class rather than an interface in order to make it possible to enhance this class in future without breaking binary compatibility; it is possible to add methods to an abstract class, but not to an interface.
Constructor and Description |
---|
RuleFinder() |
Modifier and Type | Method and Description |
---|---|
abstract RuleLoader |
findLoader(Digester d,
Class<?> pluginClass,
Properties p)
Apply the finder algorithm to attempt to locate a source of digester rules for the specified plugin class.
|
public RuleFinder()
public abstract RuleLoader findLoader(Digester d, Class<?> pluginClass, Properties p) throws PluginException
This method is invoked when a plugin is declared by the user, either via an explicit use of PluginDeclarationRule, or implicitly via an "inline declaration" where the declaration and use are simultaneous.
If dynamic rules for the specified plugin class are located, then the RuleFinder will return a RuleLoader object encapsulating those rules, and this object will be invoked each time the user actually requests an instance of the declared plugin class, to load the custom rules associated with that plugin instance.
If no dynamic rules can be found, null is returned. This is not an error; merely an indication that this particular algorithm found no matches.
The properties object holds any xml attributes the user may have specified on the plugin declaration in order to indicate how to locate the plugin rules.
d
- The digester instance where locating plugin classespluginClass
- The plugin Java classp
- The properties object that holds any xml attributes the user may have specified on the plugin
declaration in order to indicate how to locate the plugin rules.PluginException
- if the algorithm finds a source of rules, but there is something invalid
about that source.Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.