/** * Add all the public methods in the specified class. * Methods from superclasses are included, except for methods declared in the base * Object class (e.g. <code>getClass</code>, <code>equals</code>, <code>hashCode</code>). * @param class the class containing the methods to add to the interface */ public void add(Class clazz) { Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (!m.getDeclaringClass().getName().equals("java.lang.Object")) { add(m); } } }
public void generateClass(ClassVisitor v) throws Exception { ClassEmitter ce = new ClassEmitter(v); ce.begin_class(Constants.V1_2, Constants.ACC_PUBLIC | Constants.ACC_INTERFACE, getClassName(), null, null, Constants.SOURCE_FILE); for (Iterator it = signatures.keySet().iterator(); it.hasNext();) { Signature sig = (Signature)it.next(); Type[] exceptions = (Type[])signatures.get(sig); ce.begin_method(Constants.ACC_PUBLIC | Constants.ACC_ABSTRACT, sig, exceptions).end_method(); } ce.end_class(); } }
/** * Create an interface using the current set of method signatures. */ public Class create() { setUseCache(false); return (Class)super.create(this); }
/** * Add a method signature to the interface. The method modifiers are ignored, * since interface methods are by definition abstract and public. * @param method the method to add to the interface */ public void add(Method method) { add(ReflectUtils.getSignature(method), ReflectUtils.getExceptionTypes(method)); }
/** * Create an interface using the current set of method signatures. */ public Class create() { setUseCache(false); return (Class)super.create(this); }
public void generateClass(ClassVisitor v) throws Exception { ClassEmitter ce = new ClassEmitter(v); ce.begin_class(Constants.V1_2, Constants.ACC_PUBLIC | Constants.ACC_INTERFACE, getClassName(), null, null, Constants.SOURCE_FILE); for (Iterator it = signatures.keySet().iterator(); it.hasNext();) { Signature sig = (Signature)it.next(); Type[] exceptions = (Type[])signatures.get(sig); ce.begin_method(Constants.ACC_PUBLIC | Constants.ACC_ABSTRACT, sig, exceptions).end_method(); } ce.end_class(); } }
/** * Add all the public methods in the specified class. * Methods from superclasses are included, except for methods declared in the base * Object class (e.g. <code>getClass</code>, <code>equals</code>, <code>hashCode</code>). * @param class the class containing the methods to add to the interface */ public void add(Class clazz) { Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (!m.getDeclaringClass().getName().equals("java.lang.Object")) { add(m); } } }
/** * Add a method signature to the interface. The method modifiers are ignored, * since interface methods are by definition abstract and public. * @param method the method to add to the interface */ public void add(Method method) { add(ReflectUtils.getSignature(method), ReflectUtils.getExceptionTypes(method)); }