/** * Looks up a setter method by property name. * * <p>setter("foo",Integer) --> void setFoo(Integer); * * @param property The property. * @param type The type of the property. * @return The setter for the property, or null if it does not exist. */ public Method setter(String property, Class type) { Collection<Method> methods = setters.get(property); for (Method setter : methods) { if (type == null) { return setter; } else { Class target = setter.getParameterTypes()[0]; if (target.isAssignableFrom(type) || (target.isPrimitive() && type == wrapper(target)) || (type.isPrimitive() && target == wrapper(type))) { return setter; } } } // could not be found, try again with a more lax match String lax = lax(property); if (!lax.equals(property)) { return setter(lax, type); } return null; }
String lax = lax(property); if (!lax.equals(property)) { return getter(lax, type);