/** * Gets the method that this MethodDescriptor encapsualtes. * * @return The low-level description of the method */ public synchronized Method getMethod() { Method method = getMethod0(); if (method == null) { Class cls = getClass0(); if (cls != null) { Class[] params = getParams(); if (params == null) { for (int i = 0; i < 3; i++) { // Find methods for up to 2 params. We are guessing here. // This block should never execute unless the classloader // that loaded the argument classes disappears. method = Introspector.findMethod(cls, getName(), i, null); if (method != null) { break; } } } else { method = Introspector.findMethod(cls, getName(), params.length, params); } setMethod(method); } } return method; }
/** * Constructs a <code>MethodDescriptor</code> from a <code>Method</code> providing descriptive * information for each of the method's parameters. * * @param method The low-level method information. * @param parameterDescriptors Descriptive information for each of the method's parameters. */ public MethodDescriptor(Method method, ParameterDescriptor parameterDescriptors[]) { setName(method.getName()); setMethod(method); this.parameterDescriptors = parameterDescriptors; }