NoSuchMethodException on empty constructor

0 views
Skip to first unread message

hanso...@gmail.com

unread,
Mar 20, 2008, 6:57:22 PM3/20/08
to beanlib
A good question, by benguela, copied from the beanlib help forum:

https://sourceforge.net/forum/message.php?msg_id=4851807

if I have a field of a type that has no empty constructor how do I go
about
doing a copy or deepCopy without access to the fields source,

e.g.

public class A {

private com.vividsolutions.jts.geom.Point point;

}

The class Point has no empty constructor, I do not have the source to
add a
constructor, how do I proceed? I cannot wrap Point with my own class
as the
source for the objects that contain Point are generated by an external
system
and passed on to me to use.

hanso...@gmail.com

unread,
Mar 20, 2008, 6:59:05 PM3/20/08
to beanlib
Yes, this can be done with a custom bean transformer
(CustomBeanTransformerSpi)
when you instantiate and initialize a BeanReplicator. See some sample
code of how this can be done via a custom transformer:

http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-test/src/net/s
f/beanlib/spi/

Or,

http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-test/src/net/s
f/beanlib/spi/BeanTransformerSpiTest.java?revision=235&view=markup
http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-test/src/net/s
f/beanlib/spi/A.java?view=markup
http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-test/src/net/s
f/beanlib/spi/Point.java?revision=235&view=markup
Reply all
Reply to author
Forward
0 new messages