/** * Find a method in given class. * * @param javaClass the class * @param methodName the name of the method * @param methodSig the signature of the method * @param chooser the JavaClassAndMethodChooser to use to screen possible candidates * @return the XMethod, or null if no such method exists in the class */ @Deprecated public static @CheckForNull XMethod findXMethod( JavaClass javaClass, String methodName, String methodSig, JavaClassAndMethodChooser chooser) { JavaClassAndMethod result = findMethod(javaClass, methodName, methodSig, chooser); return result == null ? null : XFactory.createXMethod(result.getJavaClass(), result.getMethod()); }
/** * Find XMethod for method in given list of classes, searching the classes in order. * * @param classList list of classes in which to search * @param methodName the name of the method * @param methodSig the signature of the method * @param chooser JavaClassAndMethodChooser to select which methods are considered; it must return * true for a method to be returned * @return the XMethod, or null if no such method exists in the class */ @Deprecated public static XMethod findXMethod( JavaClass[] classList, String methodName, String methodSig, JavaClassAndMethodChooser chooser) { for (JavaClass cls : classList) { JavaClassAndMethod m; if ((m = findMethod(cls, methodName, methodSig)) != null && chooser.choose(m)) { return XFactory.createXMethod(cls, m.getMethod()); } } return null; }
/** * Look up a field with given name and signature in given class, returning it as an {@link XField * XField} object. If a field can't be found in the immediate class, its superclass is search, and * so forth. * * @param className name of the class through which the field is referenced * @param fieldName name of the field * @param fieldSig signature of the field * @param isStatic true if field is static, false otherwise * @return an XField object representing the field, or null if no such field could be found */ public static XField findXField( String className, String fieldName, String fieldSig, boolean isStatic) throws ClassNotFoundException { return XFactory.createXField(className, fieldName, fieldSig, isStatic); }
/** Convert to an XMethod. */ public XMethod toXMethod() { return XFactory.createXMethod(javaClass, method); }