SetNextRule的提取Digest中stack栈中,最上面的两年参数,以第一个为child,第二个为parent。
public void end() throws Exception {
Object child = digester.peek(0);
Object parent = digester.peek(1);
...................
//Call the specified method
Class paramTypes[] = new Class[1];
if (paramType != null)
paramTypes[0] = digester.getClassLoader().loadClass(paramType);
else
paramTypes[0] = child.getClass();
if (useExactMatch) {
MethodUtils.invokeExactMethod(parent, methodName, new Object[] {child}, paramTypes);
}
else
MethodUtils.invokeMethod(parent, methodName, new Object[]{ child }, paramTypes);
}
SetRootRule提取Digest中Stack中,第一个为child,最底层的为parent.
Object child = digester.peek(0);
Object parent = digester.root;
.................
Class paramTypes[] = new Class[1];
if (paramType != null) {
paramTypes[0] = digester.getClassLoader().loadClass(paramType);
} else {
paramTypes[0] = child.getClass();
}
if (useExactMatch) {
MethodUtils.invokeExactMethod(parent, methodName,
new Object[] { child }, paramTypes);
} else {
MethodUtils.invokeMethod(parent, methodName,
new Object[] { child }, paramTypes);
}