/** * Makes a descriptor for a given method. */ public static String makeDescriptor(Method m) { Class[] params = m.getParameterTypes(); return makeDescriptor(params, m.getReturnType()); }
/** * Finds a method that has the given name and descriptor and is declared * in the super class. * * @throws RuntimeException if the method is not found. */ public static Method findSuperClassMethod(Class clazz, String name, String desc) { Method m = findSuperMethod2(clazz.getSuperclass(), name, desc); if (m == null) m = searchInterfaces(clazz, name, desc); if (m == null) error(clazz, name, desc); return m; }
private static Method findSuperMethod2(Class clazz, String name, String desc) { Method m = findMethod2(clazz, name, desc); if (m != null) return m; Class superClass = clazz.getSuperclass(); if (superClass != null) { m = findSuperMethod2(superClass, name, desc); if (m != null) return m; } return searchInterfaces(clazz, name, desc); }
/** * Finds a method with the given name and descriptor. * It searches only the class of self. * * @throws RuntimeException if the method is not found. */ public static Method findMethod(Class clazz, String name, String desc) { Method m = findMethod2(clazz, name, desc); if (m == null) error(clazz, name, desc); return m; }
/** * Finds two methods specified by the parameters and stores them * into the given array. * * @throws RuntimeException if the methods are not found. * @see javassist.util.proxy.ProxyFactory */ public static void find2Methods(Class clazz, String superMethod, String thisMethod, int index, String desc, java.lang.reflect.Method[] methods) { methods[index + 1] = thisMethod == null ? null : findMethod(clazz, thisMethod, desc); methods[index] = findSuperClassMethod(clazz, superMethod, desc); }
/** * Makes a descriptor for a given method. * * @param params the descriptor of parameter types. * @param retType return type. */ public static String makeDescriptor(String params, Class retType) { StringBuffer sbuf = new StringBuffer(params); makeDesc(sbuf, retType); return sbuf.toString(); }
/** * Finds two methods specified by the parameters and stores them * into the given array. * * <p>Added back for JBoss Seam. See JASSIST-206.</p> * * @throws RuntimeException if the methods are not found. * @see javassist.util.proxy.ProxyFactory * @deprecated replaced by {@link #find2Methods(Class, String, String, int, String, Method[])} */ public static void find2Methods(Object self, String superMethod, String thisMethod, int index, String desc, java.lang.reflect.Method[] methods) { methods[index + 1] = thisMethod == null ? null : findMethod(self, thisMethod, desc); methods[index] = findSuperMethod(self, superMethod, desc); }
private static Method searchInterfaces(Class clazz, String name, String desc) { Method m = null; Class[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { m = findSuperMethod2(interfaces[i], name, desc); if (m != null) return m; } return m; }
/** * Finds a method that has the given name and descriptor and is declared * in the super class. * * @throws RuntimeException if the method is not found. */ public static Method findSuperMethod(Object self, String name, String desc) { // for JBoss Seam. See JASSIST-183. Class clazz = self.getClass(); return findSuperClassMethod(clazz, name, desc); }
/** * Finds a method with the given name and descriptor. * It searches only the class of self. * * @throws RuntimeException if the method is not found. */ public static Method findMethod(Class<?> clazz, String name, String desc) { Method m = findMethod2(clazz, name, desc); if (m == null) error(clazz, name, desc); return m; }
/** * Makes a descriptor for a given method. * * @param params parameter types. * @param retType return type. */ public static String makeDescriptor(Class[] params, Class retType) { StringBuffer sbuf = new StringBuffer(); sbuf.append('('); for (int i = 0; i < params.length; i++) makeDesc(sbuf, params[i]); sbuf.append(')'); if (retType != null) makeDesc(sbuf, retType); return sbuf.toString(); }
/** * Finds two methods specified by the parameters and stores them * into the given array. * * <p>Added back for JBoss Seam. See JASSIST-206.</p> * * @throws RuntimeException if the methods are not found. * @see javassist.util.proxy.ProxyFactory * @deprecated replaced by {@link #find2Methods(Class, String, String, int, String, Method[])} */ @Deprecated public static void find2Methods(Object self, String superMethod, String thisMethod, int index, String desc, java.lang.reflect.Method[] methods) { methods[index + 1] = thisMethod == null ? null : findMethod(self, thisMethod, desc); methods[index] = findSuperMethod(self, superMethod, desc); }
/** * Finds two methods specified by the parameters and stores them * into the given array. * * @throws RuntimeException if the methods are not found. * @see javassist.util.proxy.ProxyFactory */ public static void find2Methods(Class<?> clazz, String superMethod, String thisMethod, int index, String desc, java.lang.reflect.Method[] methods) { methods[index + 1] = thisMethod == null ? null : findMethod(clazz, thisMethod, desc); methods[index] = findSuperClassMethod(clazz, superMethod, desc); }
private static Method searchInterfaces(Class<?> clazz, String name, String desc) { Method m = null; Class<?>[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { m = findSuperMethod2(interfaces[i], name, desc); if (m != null) return m; } return m; }
/** * Finds a method that has the given name and descriptor and is declared * in the super class. * * @throws RuntimeException if the method is not found. */ public static Method findSuperMethod(Object self, String name, String desc) { // for JBoss Seam. See JASSIST-183. Class<?> clazz = self.getClass(); return findSuperClassMethod(clazz, name, desc); }
/** * Makes a descriptor for a given method. */ public static String makeDescriptor(Method m) { Class<?>[] params = m.getParameterTypes(); return makeDescriptor(params, m.getReturnType()); }
private static Method findSuperMethod2(Class<?> clazz, String name, String desc) { Method m = findMethod2(clazz, name, desc); if (m != null) return m; Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { m = findSuperMethod2(superClass, name, desc); if (m != null) return m; } return searchInterfaces(clazz, name, desc); }
/** * Finds a method that has the given name and descriptor and is declared * in the super class. * * @throws RuntimeException if the method is not found. */ public static Method findSuperClassMethod(Class<?> clazz, String name, String desc) { Method m = findSuperMethod2(clazz.getSuperclass(), name, desc); if (m == null) m = searchInterfaces(clazz, name, desc); if (m == null) error(clazz, name, desc); return m; }
/** * Finds a method with the given name and descriptor. * It searches only the class of self. * * <p>Added back for JBoss Seam. See JASSIST-206.</p> * * @throws RuntimeException if the method is not found. * @deprecated replaced by {@link #findMethod(Class, String, String)} */ public static Method findMethod(Object self, String name, String desc) { Method m = findMethod2(self.getClass(), name, desc); if (m == null) error(self.getClass(), name, desc); return m; }
/** * Makes a descriptor for a given method. * * @param params the descriptor of parameter types. * @param retType return type. */ public static String makeDescriptor(String params, Class<?> retType) { StringBuffer sbuf = new StringBuffer(params); makeDesc(sbuf, retType); return sbuf.toString(); }