You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jason Pyeron <jp...@pdinc.us> on 2011/09/26 20:10:01 UTC

[beanutils] copyProperty unneeded conversions

I was looking at the copyProperty and the always convert caught my eye.

Should we check to see if the destination type is the same as the src type and
skip the conversion in that case?

  public void copyProperty(Object bean, String name, Object value)
    throws IllegalAccessException, InvocationTargetException
  {
	//...
        descriptor = getPropertyUtils().getPropertyDescriptor(target, name);
	//...
      type = descriptor.getPropertyType();
	//...
	 value = convert(value, type);
	//...
        getPropertyUtils().setSimpleProperty(target, propName, value);
  }

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org