Class LoaderFromClass
java.lang.Object
org.apache.commons.digester3.plugins.RuleLoader
org.apache.commons.digester3.plugins.strategies.LoaderFromClass
A RuleLoader which invokes a static method on a target class, leaving that method to actually instantiate and add new
rules to a Digester instance.
- Since:
- 1.6
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLoaderFromClass
(Class<?> rulesClass, Method rulesMethod) Constructor.LoaderFromClass
(Class<?> rulesClass, String methodName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Configures the digester with custom rules for some plugged-in class.static Method
locateMethod
(Class<?> rulesClass, String methodName) Find a method on the specified class whose name matches methodName, and whose signature is:public static void foo(Digester d, String patternPrefix);
.
-
Field Details
-
rulesClass
-
rulesMethod
-
-
Constructor Details
-
LoaderFromClass
Constructor.- Parameters:
rulesClass
- The target classrulesMethod
- The method has to be invoked
-
LoaderFromClass
Constructor.- Parameters:
rulesClass
- The target classmethodName
- The method name has to be invoked- Throws:
PluginException
- if input method can't be located inside the given class
-
-
Method Details
-
addRules
Configures the digester with custom rules for some plugged-in class.This method is invoked when the start of an xml tag is encountered which maps to a PluginCreateRule. Any rules added here are removed from the digester when the end of that xml tag is encountered.
- Specified by:
addRules
in classRuleLoader
- Parameters:
d
- The gigester has to be configuredpath
- The path where rule has to be bound- Throws:
PluginException
- if any error occurs
-
locateMethod
Find a method on the specified class whose name matches methodName, and whose signature is:public static void foo(Digester d, String patternPrefix);
.- Parameters:
rulesClass
- The target classmethodName
- The method name has to be invoked- Returns:
- The method name has to be invoked, or null if no such method exists.
- Throws:
PluginException
- if any error occurs while discovering the method
-