1 18 19 20 package org.apache.tomcat.util.digester; 21 22 import org.apache.tomcat.util.IntrospectionUtils; 23 24 25 35 36 public class SetRootRule extends Rule { 37 38 39 41 42 53 public SetRootRule(Digester digester, String methodName) { 54 55 this(methodName); 56 57 } 58 59 60 73 public SetRootRule(Digester digester, String methodName, 74 String paramType) { 75 76 this(methodName, paramType); 77 78 } 79 80 87 public SetRootRule(String methodName) { 88 89 this(methodName, null); 90 91 } 92 93 94 103 public SetRootRule(String methodName, 104 String paramType) { 105 106 this.methodName = methodName; 107 this.paramType = paramType; 108 109 } 110 111 113 114 117 protected String methodName = null; 118 119 120 123 protected String paramType = null; 124 125 128 protected boolean useExactMatch = false; 129 130 131 133 134 154 public boolean isExactMatch() { 155 156 return useExactMatch; 157 } 158 159 160 168 public void setExactMatch(boolean useExactMatch) { 169 170 this.useExactMatch = useExactMatch; 171 } 172 173 176 public void end() throws Exception { 177 178 Object child = digester.peek(0); 180 Object parent = digester.root; 181 if (digester.log.isDebugEnabled()) { 182 if (parent == null) { 183 digester.log.debug("[SetRootRule]{" + digester.match + 184 "} Call [NULL ROOT]." + 185 methodName + "(" + child + ")"); 186 } else { 187 digester.log.debug("[SetRootRule]{" + digester.match + 188 "} Call " + parent.getClass().getName() + "." + 189 methodName + "(" + child + ")"); 190 } 191 } 192 193 IntrospectionUtils.callMethod1(parent, methodName, 195 child, paramType, digester.getClassLoader()); 196 197 } 198 199 200 203 public String toString() { 204 205 StringBuffer sb = new StringBuffer ("SetRootRule["); 206 sb.append("methodName="); 207 sb.append(methodName); 208 sb.append(", paramType="); 209 sb.append(paramType); 210 sb.append("]"); 211 return (sb.toString()); 212 213 } 214 215 216 } 217 | Popular Tags |