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 SetNextRule extends Rule { 37 38 39 41 42 53 public SetNextRule(Digester digester, String methodName) { 54 55 this(methodName); 56 57 } 58 59 60 73 public SetNextRule(Digester digester, String methodName, 74 String paramType) { 75 76 this(methodName, paramType); 77 78 } 79 80 87 public SetNextRule(String methodName) { 88 89 this(methodName, null); 90 91 } 92 93 94 103 public SetNextRule(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 133 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 if (digester.log.isDebugEnabled()) { 181 if (parent == null) { 182 digester.log.debug("[SetNextRule]{" + digester.match + 183 "} Call [NULL PARENT]." + 184 methodName + "(" + child + ")"); 185 } else { 186 digester.log.debug("[SetNextRule]{" + digester.match + 187 "} Call " + parent.getClass().getName() + "." + 188 methodName + "(" + child + ")"); 189 } 190 } 191 192 IntrospectionUtils.callMethod1(parent, methodName, 194 child, paramType, digester.getClassLoader()); 195 196 } 197 198 199 202 public String toString() { 203 204 StringBuffer sb = new StringBuffer ("SetNextRule["); 205 sb.append("methodName="); 206 sb.append(methodName); 207 sb.append(", paramType="); 208 sb.append(paramType); 209 sb.append("]"); 210 return (sb.toString()); 211 212 } 213 214 215 } 216 | Popular Tags |