1 18 package org.apache.beehive.netui.tags.databinding.invoke; 19 20 import org.apache.beehive.netui.util.Bundle; 21 import org.apache.beehive.netui.util.internal.cache.MethodCache; 22 23 import javax.servlet.jsp.JspException ; 24 import java.lang.reflect.Method ; 25 import java.util.List ; 26 27 78 public class CallMethod 79 extends AbstractCallMethod { 80 81 private static final String DEFAULT_OBJECT_NAME = Bundle.getString("Tags_CallMethod_defaultObjectName"); 82 private static final MethodCache _cache = new MethodCache(); 83 84 private Object _object = null; 85 86 92 public String getTagName() { 93 return "CallMethod"; 94 } 95 96 104 public void setObject(Object object) { 105 _object = object; 106 } 107 108 111 protected void localRelease() { 112 super.localRelease(); 113 _object = null; 114 } 115 116 protected Object resolveObject() 117 throws ObjectNotFoundException, JspException { 118 return _object; 119 } 120 121 protected final Method findMethod(Object target, String methodName, boolean verifyTypes) { 122 List params = getParameterNodes(); 123 124 if(verifyTypes) { 125 String [] argTypes = null; 126 argTypes = new String [params.size()]; 127 for(int i = 0; i < argTypes.length; i++) { 128 argTypes[i] = ((ParamNode)params.get(i)).typeName; 129 } 130 return _cache.getMethod(target.getClass(), methodName, argTypes); 131 } 132 else 133 return _cache.getMethod(target.getClass(), methodName, params.size()); 134 } 135 136 protected String getObjectName() { 137 return DEFAULT_OBJECT_NAME; 138 } 139 } 140 | Popular Tags |