Wednesday, 15 July 2015

java - Using JAXB to shovel the content of an objects into a new instance of a different type -



java - Using JAXB to shovel the content of an objects into a new instance of a different type -

is there simple way re-create 1 objects content new object of different class/target type. objects share @ to the lowest degree superclass , lot properties/attributes.

i used approach different target class: http://stackoverflow.com/a/3899882/1949775. don't exception somehow wrong target type result...

what i'm looking easy way shovel 1 objects content new instance of different target type source is.

thanks help.

you can seek apache commons-beanutils

beanutils.copyproperties(source, target);

api

copies property values of given source bean target bean.

note: source , target classes not have match or derived each other, long properties match. bean properties source bean exposes target bean not silently ignored.

this convenience method. more complex transfer needs, consider using total beanwrapper.

java xml jaxb

No comments:

Post a Comment