1 16 17 import org.apache.commons.beanutils.MethodUtils; 18 import org.apache.commons.digester.Rule; 19 20 24 25 public class SetTextSegmentRule extends Rule implements TextSegmentHandler { 26 27 28 30 public SetTextSegmentRule(String methodName) { 31 this.methodName = methodName; 32 } 33 34 36 37 40 protected String methodName = null; 41 42 44 47 public void textSegment(String text) throws Exception { 48 49 Object target = digester.peek(0); 50 51 Class paramTypes[] = new Class [] {String .class}; 53 MethodUtils.invokeMethod(target, methodName, 54 new Object []{ text }, paramTypes); 55 } 56 } 57 | Popular Tags |