1 17 18 package org.apache.commons.digester.plugins.strategies; 19 20 import java.util.Properties ; 21 import java.lang.reflect.Method ; 22 23 import org.apache.commons.digester.Digester; 24 import org.apache.commons.digester.plugins.RuleFinder; 25 import org.apache.commons.digester.plugins.RuleLoader; 26 import org.apache.commons.digester.plugins.PluginException; 27 28 34 35 public class FinderFromDfltMethod extends RuleFinder { 36 public static String DFLT_METHOD_NAME = "addRules"; 37 38 private String methodName; 39 40 41 public FinderFromDfltMethod() { 42 this(DFLT_METHOD_NAME); 43 } 44 45 52 public FinderFromDfltMethod(String methodName) { 53 this.methodName = methodName; 54 } 55 56 68 public RuleLoader findLoader(Digester d, Class pluginClass, Properties p) 69 throws PluginException { 70 71 Method rulesMethod = LoaderFromClass.locateMethod(pluginClass, methodName); 72 if (rulesMethod == null) { 73 return null; 74 } 75 76 return new LoaderFromClass(pluginClass, rulesMethod); 77 } 78 } 79 80 | Popular Tags |