/** Returns the static method defined in an element, or null if failed. */ /*package*/ static MethodInfo getMethodInfo(Element el) { final String clsnm = IDOMs.getRequiredAttributeValue(el, "class"); final String sig = IDOMs.getRequiredAttributeValue(el, "signature"); final Class cls; try { cls = Classes.forNameByThread(clsnm); } catch (ClassNotFoundException ex) { log.error("Class not found: " + clsnm + ", " + el.getLocator()); return null; // to report as many errors as possible } try { final Method mtd = Classes.getMethodBySignature(cls, sig, null); if ((mtd.getModifiers() & Modifier.STATIC) == 0) { log.error("Not a static method: " + mtd); return null; } final Object[] args = new Object[mtd.getParameterTypes().length]; for (int j = 0; j < args.length; ++j) args[j] = el.getAttributeValue("arg" + j); return new MethodInfo(mtd, args); } catch (ClassNotFoundException ex) { log.realCauseBriefly( "Unable to load class when resolving " + sig + " " + el.getLocator(), ex); } catch (NoSuchMethodException ex) { log.error("Method not found in " + clsnm + ": " + sig + " " + el.getLocator()); } return null; }