/** * Helper method to return the named method of the given class, throwing * the proper exception on error. */ protected static Method getMethod(Class cls, String method, Class[] args) { Class currentClass = cls; do { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(currentClass)); for (int i = 0; i < methods.length; i++) { if (!method.equals(methods[i].getName())) continue; if (isAssignable(methods[i].getParameterTypes(), args)) return methods[i]; } } while ((currentClass = currentClass.getSuperclass()) != null); // if we get here, no suitable method was found throw new UserException(_loc.get("method-notfound", cls.getName(), method, args == null ? null : Arrays.asList(args))); }
/** * Helper method to return the named method of the given class, throwing * the proper exception on error. */ protected static Method getMethod(Class cls, String method, Class[] args) { Class currentClass = cls; do { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(currentClass)); for (int i = 0; i < methods.length; i++) { if (!method.equals(methods[i].getName())) continue; if (isAssignable(methods[i].getParameterTypes(), args)) return methods[i]; } } while ((currentClass = currentClass.getSuperclass()) != null); // if we get here, no suitable method was found throw new UserException(_loc.get("method-notfound", cls.getName(), method, args == null ? null : Arrays.asList(args))); }
/** * Invokes <code>cls.getDeclaredMethods()</code>, and returns the method * that matches the <code>name</code> and <code>param</code> arguments. * Avoids the exception thrown by <code>Class.getDeclaredMethod()</code> * for performance reasons. <code>param</code> may be null. Additionally, * if there are multiple methods with different return types, this will * return the method defined in the least-derived class. * * @since 0.9.8 */ static Method getDeclaredMethod(Class cls, String name, Class param) { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(cls)); Method candidate = null; for (int i = 0 ; i < methods.length; i++) { if (name.equals(methods[i].getName())) { Class[] methodParams = methods[i].getParameterTypes(); if (param == null && methodParams.length == 0) candidate = mostDerived(methods[i], candidate); else if (param != null && methodParams.length == 1 && param.equals(methodParams[0])) candidate = mostDerived(methods[i], candidate); } } return candidate; }
/** * Invokes <code>cls.getDeclaredMethods()</code>, and returns the method * that matches the <code>name</code> and <code>param</code> arguments. * Avoids the exception thrown by <code>Class.getDeclaredMethod()</code> * for performance reasons. <code>param</code> may be null. Additionally, * if there are multiple methods with different return types, this will * return the method defined in the least-derived class. * * @since 0.9.8 */ static Method getDeclaredMethod(Class cls, String name, Class param) { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(cls)); Method candidate = null; for (int i = 0 ; i < methods.length; i++) { if (name.equals(methods[i].getName())) { Class[] methodParams = methods[i].getParameterTypes(); if (param == null && methodParams.length == 0) candidate = mostDerived(methods[i], candidate); else if (param != null && methodParams.length == 1 && param.equals(methodParams[0])) candidate = mostDerived(methods[i], candidate); } } return candidate; }
/** * Invokes <code>cls.getDeclaredMethods()</code>, and returns the method * that matches the <code>name</code> and <code>param</code> arguments. * Avoids the exception thrown by <code>Class.getDeclaredMethod()</code> * for performance reasons. <code>param</code> may be null. Additionally, * if there are multiple methods with different return types, this will * return the method defined in the least-derived class. * * @since 0.9.8 */ static Method getDeclaredMethod(Class cls, String name, Class param) { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(cls)); Method candidate = null; for (int i = 0 ; i < methods.length; i++) { if (name.equals(methods[i].getName())) { Class[] methodParams = methods[i].getParameterTypes(); if (param == null && methodParams.length == 0) candidate = mostDerived(methods[i], candidate); else if (param != null && methodParams.length == 1 && param.equals(methodParams[0])) candidate = mostDerived(methods[i], candidate); } } return candidate; }
/** * Invokes <code>cls.getDeclaredMethods()</code>, and returns the method * that matches the <code>name</code> and <code>param</code> arguments. * Avoids the exception thrown by <code>Class.getDeclaredMethod()</code> * for performance reasons. <code>param</code> may be null. Additionally, * if there are multiple methods with different return types, this will * return the method defined in the least-derived class. * * @since 0.9.8 */ static Method getDeclaredMethod(Class cls, String name, Class param) { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(cls)); Method candidate = null; for (int i = 0 ; i < methods.length; i++) { if (name.equals(methods[i].getName())) { Class[] methodParams = methods[i].getParameterTypes(); if (param == null && methodParams.length == 0) candidate = mostDerived(methods[i], candidate); else if (param != null && methodParams.length == 1 && param.equals(methodParams[0])) candidate = mostDerived(methods[i], candidate); } } return candidate; }
/** * Helper method to return the named method of the given class, throwing * the proper exception on error. */ protected static Method getMethod(Class cls, String method, Class[] args) { Class currentClass = cls; do { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(currentClass)); for (int i = 0; i < methods.length; i++) { if (!method.equals(methods[i].getName())) continue; if (isAssignable(methods[i].getParameterTypes(), args)) return methods[i]; } } while ((currentClass = currentClass.getSuperclass()) != null); // if we get here, no suitable method was found throw new UserException(_loc.get("method-notfound", cls.getName(), method, args == null ? null : Arrays.asList(args))); }
/** * Helper method to return the named method of the given class, throwing * the proper exception on error. */ protected static Method getMethod(Class cls, String method, Class[] args) { Class currentClass = cls; do { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(currentClass)); for (int i = 0; i < methods.length; i++) { if (!method.equals(methods[i].getName())) continue; if (isAssignable(methods[i].getParameterTypes(), args)) return methods[i]; } } while ((currentClass = currentClass.getSuperclass()) != null); // if we get here, no suitable method was found throw new UserException(_loc.get("method-notfound", cls.getName(), method, args == null ? null : Arrays.asList(args))); }
/** * Helper method to return the named method of the given class, throwing * the proper exception on error. */ protected static Method getMethod(Class cls, String method, Class[] args) { Class currentClass = cls; do { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(currentClass)); for (int i = 0; i < methods.length; i++) { if (!method.equals(methods[i].getName())) continue; if (isAssignable(methods[i].getParameterTypes(), args)) return methods[i]; } } while ((currentClass = currentClass.getSuperclass()) != null); // if we get here, no suitable method was found throw new UserException(_loc.get("method-notfound", cls.getName(), method, args == null ? null : Arrays.asList(args))); }
/** * Invokes <code>cls.getDeclaredMethods()</code>, and returns the method * that matches the <code>name</code> and <code>param</code> arguments. * Avoids the exception thrown by <code>Class.getDeclaredMethod()</code> * for performance reasons. <code>param</code> may be null. Additionally, * if there are multiple methods with different return types, this will * return the method defined in the least-derived class. * * @since 0.9.8 */ static Method getDeclaredMethod(Class cls, String name, Class param) { Method[] methods = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(cls)); Method candidate = null; for (int i = 0 ; i < methods.length; i++) { if (name.equals(methods[i].getName())) { Class[] methodParams = methods[i].getParameterTypes(); if (param == null && methodParams.length == 0) candidate = mostDerived(methods[i], candidate); else if (param != null && methodParams.length == 1 && param.equals(methodParams[0])) candidate = mostDerived(methods[i], candidate); } } return candidate; }
/** * Invalidate methods on the interface which are not managed. */ private void invalidateNonBeanMethods(BCClass bc, Class<?> iface, Set<Method> methods) { Method[] meths = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(iface)); BCMethod meth; Code code; Class<?> type = _repos.getMetaDataFactory().getDefaults(). getUnimplementedExceptionType(); for (int i = 0; i < meths.length; i++) { if (methods.contains(meths[i])) continue; meth = bc.declareMethod(meths[i].getName(), meths[i].getReturnType(), meths[i].getParameterTypes()); meth.makePublic(); code = meth.getCode(true); code.anew().setType(type); code.dup(); code.invokespecial().setMethod(type, "<init>", void.class, null); code.athrow(); code.calculateMaxLocals(); code.calculateMaxStack(); } }
/** * Invalidate methods on the interface which are not managed. */ private void invalidateNonBeanMethods(BCClass bc, Class<?> iface, Set<Method> methods) { Method[] meths = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(iface)); BCMethod meth; Code code; Class<?> type = _repos.getMetaDataFactory().getDefaults(). getUnimplementedExceptionType(); for (int i = 0; i < meths.length; i++) { if (methods.contains(meths[i])) continue; meth = bc.declareMethod(meths[i].getName(), meths[i].getReturnType(), meths[i].getParameterTypes()); meth.makePublic(); code = meth.getCode(true); code.anew().setType(type); code.dup(); code.invokespecial().setMethod(type, "<init>", void.class, null); code.athrow(); code.calculateMaxLocals(); code.calculateMaxStack(); } }
else members = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction( meta.getDescribedType()));
/** * Invalidate methods on the interface which are not managed. */ private void invalidateNonBeanMethods(BCClass bc, Class iface, Set methods) { Method[] meths = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(iface)); BCMethod meth; Code code; Class type = _repos.getMetaDataFactory().getDefaults(). getUnimplementedExceptionType(); for (int i = 0; i < meths.length; i++) { if (methods.contains(meths[i])) continue; meth = bc.declareMethod(meths[i].getName(), meths[i].getReturnType(), meths[i].getParameterTypes()); meth.makePublic(); code = meth.getCode(true); code.anew().setType(type); code.dup(); code.invokespecial().setMethod(type, "<init>", void.class, null); code.athrow(); code.calculateMaxLocals(); code.calculateMaxStack(); } }
/** * Invalidate methods on the interface which are not managed. */ private void invalidateNonBeanMethods(BCClass bc, Class<?> iface, Set<Method> methods) { Method[] meths = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(iface)); BCMethod meth; Code code; Class<?> type = _repos.getMetaDataFactory().getDefaults(). getUnimplementedExceptionType(); for (int i = 0; i < meths.length; i++) { if (methods.contains(meths[i])) continue; meth = bc.declareMethod(meths[i].getName(), meths[i].getReturnType(), meths[i].getParameterTypes()); meth.makePublic(); code = meth.getCode(true); code.anew().setType(type); code.dup(); code.invokespecial().setMethod(type, "<init>", void.class, null); code.athrow(); code.calculateMaxLocals(); code.calculateMaxStack(); } }
/** * Invalidate methods on the interface which are not managed. */ private void invalidateNonBeanMethods(BCClass bc, Class<?> iface, Set<Method> methods) { Method[] meths = (Method[]) AccessController.doPrivileged( J2DoPrivHelper.getDeclaredMethodsAction(iface)); BCMethod meth; Code code; Class<?> type = _repos.getMetaDataFactory().getDefaults(). getUnimplementedExceptionType(); for (int i = 0; i < meths.length; i++) { if (methods.contains(meths[i])) continue; meth = bc.declareMethod(meths[i].getName(), meths[i].getReturnType(), meths[i].getParameterTypes()); meth.makePublic(); code = meth.getCode(true); code.anew().setType(type); code.dup(); code.invokespecial().setMethod(type, "<init>", void.class, null); code.athrow(); code.calculateMaxLocals(); code.calculateMaxStack(); } }
J2DoPrivHelper.getDeclaredMethodsAction(meta.getDescribedType()));
J2DoPrivHelper.getDeclaredMethodsAction(meta.getDescribedType()));
J2DoPrivHelper.getDeclaredMethodsAction(meta.getDescribedType()));
J2DoPrivHelper.getDeclaredMethodsAction(meta.getDescribedType()));