code: private static Method findSetterWithCompatibleParamType(final Class<?> clazz, final String setterName,
  		final Class<?> argumentType) {
  		
  		Class<?> actualType = clazz;
  		Method compatibleSetter = null;
  		while( actualType != null && compatibleSetter == null ) {
  			Method[] methods = actualType.getDeclaredMethods();
  			for( Method method : methods ) {
  				if( !setterName.equalsIgnoreCase(method.getName()) || method.getParameterTypes().length != 1 ) {
  					continue; // setter must have correct name and only 1 parameter
  				}
  				
  				final Class<?> parameterType = method.getParameterTypes()[0];
  				if( parameterType.equals(argumentType) ) {
  					return method;
  				} else if( parameterType.isAssignableFrom(argumentType) ) {
  					compatibleSetter = method; // potential match, but keep looking for exact match
  				}
  			}
  			actualType = actualType.getSuperclass();
  		}
  		
  		return compatibleSetter;
  	}
docs: Helper method for findSetter() that returns the setter method of the supplied name, whose parameter type is
  compatible with the supplied argument type (will allow an object of that type to be used when invoking the
  setter), or returns <tt>null</tt> if no match is found. Preference is given to setters whose parameter type is an
  exact match, but if there is none, then the first compatible method found is returned.
  
  @param clazz
  the class containing the setter
  @param setterName
  the name of the setter
  @param argumentType
  the type to be passed to the setter
  @return the setter method, or null if none is found