/** * Checks for an implementation, first finding the given class by name. * * @param className name of a class * @param methodName name of a method (different from constructor) * @param argClasses argument classes for the method * @return this Builder for method chaining * @see java.lang.Class#forName(String) * @see java.lang.Class#getMethod(String, Class[]) */ public Builder impl(String className, String methodName, Class<?>... argClasses) { // don't do any work if an implementation has been found if (method != null) { return this; } try { Class<?> targetClass = Class.forName(className, true, loader); impl(targetClass, methodName, argClasses); } catch (ClassNotFoundException e) { // not the right implementation } return this; }
/** * Checks for an implementation, first finding the given class by name. * * The name passed to the constructor is the method name used. * * @param className name of a class * @param argClasses argument classes for the method * @return this Builder for method chaining * @see java.lang.Class#forName(String) * @see java.lang.Class#getMethod(String, Class[]) */ public Builder impl(String className, Class<?>... argClasses) { impl(className, name, argClasses); return this; }
/** * Checks for a method implementation. * * The name passed to the constructor is the method name used. * * @param targetClass a class instance * @param argClasses argument classes for the method * @return this Builder for method chaining * @see java.lang.Class#forName(String) * @see java.lang.Class#getMethod(String, Class[]) */ public Builder impl(Class<?> targetClass, Class<?>... argClasses) { impl(targetClass, name, argClasses); return this; }