/** * Returns all Method objects that are cached by the proxy. These Methods objects are passed to the proxies * {@link InvocationHandler} when the corresponding proxy action is invoked * * @return The cached methods */ public List<Method> getCachedMethods() { defineClass(); return cachedMethods; }
methods[entry.getValue()] = entry.getKey(); MethodStore.METHODS.put(new ClassIdentifier(classFile.getName(), getClassLoader()), methods); ca.ldc(i); ca.aaload(); ca.putstatic(getClassName(), METHOD_FIELD_PREFIX + i, METHOD_FIELD_DESCRIPTOR);
/** * This method must be called by subclasses after they have finished generating the class. */ protected void finalizeStaticConstructor() { setupCachedProxyFields(); staticConstructor.getCodeAttribute().returnInstruction(); }
/** * Writes the bytecode to load an instance of Method for the given method onto the stack * <p/> * If loadMethod has not already been called for the given method then a static field to hold the method is added to the * class, and code is added to the static constructor to initialize the field to the correct Method. * * @param methodToLoad the method to load * @param method the subclass method to populate */ protected void loadMethodIdentifier(Method methodToLoad, ClassMethod method) { if (!methodIdentifiers.containsKey(methodToLoad)) { int identifierNo = identifierCount++; String fieldName = METHOD_FIELD_PREFIX + identifierNo; classFile.addField(AccessFlag.PRIVATE | AccessFlag.STATIC, fieldName, Method.class); methodIdentifiers.put(methodToLoad, identifierNo); } final Integer fieldNo = methodIdentifiers.get(methodToLoad); method.getCodeAttribute().getstatic(getClassName(), METHOD_FIELD_PREFIX + fieldNo, METHOD_FIELD_DESCRIPTOR); }