1 18 19 20 package org.apache.tomcat.util.digester; 21 22 23 import org.apache.tomcat.util.IntrospectionUtils; 24 25 26 35 36 public class SetTopRule extends Rule { 37 38 39 41 42 53 public SetTopRule(Digester digester, String methodName) { 54 55 this(methodName); 56 57 } 58 59 60 73 public SetTopRule(Digester digester, String methodName, 74 String paramType) { 75 76 this(methodName, paramType); 77 78 } 79 80 87 public SetTopRule(String methodName) { 88 89 this(methodName, null); 90 91 } 92 93 94 103 public SetTopRule(String methodName, 104 String paramType) { 105 106 this.methodName = methodName; 107 this.paramType = paramType; 108 109 } 110 111 112 114 115 118 protected String methodName = null; 119 120 121 124 protected String paramType = null; 125 126 129 protected boolean useExactMatch = false; 130 131 132 134 154 public boolean isExactMatch() { 155 156 return useExactMatch; 157 } 158 159 167 public void setExactMatch(boolean useExactMatch) { 168 169 this.useExactMatch = useExactMatch; 170 } 171 172 175 public void end() throws Exception { 176 177 Object child = digester.peek(0); 179 Object parent = digester.peek(1); 180 181 if (digester.log.isDebugEnabled()) { 182 if (child == null) { 183 digester.log.debug("[SetTopRule]{" + digester.match + 184 "} Call [NULL CHILD]." + 185 methodName + "(" + parent + ")"); 186 } else { 187 digester.log.debug("[SetTopRule]{" + digester.match + 188 "} Call " + child.getClass().getName() + "." + 189 methodName + "(" + parent + ")"); 190 } 191 } 192 193 IntrospectionUtils.callMethod1(child, methodName, 195 parent, paramType, digester.getClassLoader()); 196 197 } 198 199 200 203 public String toString() { 204 205 StringBuffer sb = new StringBuffer ("SetTopRule["); 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 |