Re: [Simple-support] Problem deserializing an inner class
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2008-08-23 07:42:03
|
Hi,
The inner class needs to be static. Otherwise it can not be instantiated reflectively.
Niall
--- On Fri, 8/22/08, Alan Deikman <Ala...@zn...> wrote:
> From: Alan Deikman <Ala...@zn...>
> Subject: [Simple-support] Problem deserializing an inner class
> To: sim...@li...
> Date: Friday, August 22, 2008, 5:15 PM
> I got stuck on this. I'm using inner classes and a
> CycleStrategy, and
> the serialization seems to work fine. However on
> de-serialization I get
> an exception thrown:
>
> > java.lang.NoSuchMethodException:
> com.test.Outer$Inner.<init>()
> > at
> java.lang.Class.getConstructor0(Class.java:2706)
> > at
> java.lang.Class.getDeclaredConstructor(Class.java:1985)
> > at
> >
> org.simpleframework.xml.graph.Instance.getInstance(Instance.java:75)
> > at
> >
> org.simpleframework.xml.graph.Instance.getInstance(Instance.java:62)
> (etc)
>
> This is from the template:
>
> @Root public class Outer {
> ....
> @Element private String whatever;
>
> public class Inner {
> @Element private String whenever;
> }
>
> @ElementList protected ArrayList<Inner> innards;
>
> }
>
> It doesn't make any difference whether I put a
> constructor on the inner
> class or not. However the XML output looks as logical as
> a
> checkerboard. Any ideas what is going wrong?
>
> Regards,
>
> --
> Alan
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK
> & win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Simple-support mailing list
> Sim...@li...
> https://lists.sourceforge.net/lists/listinfo/simple-support
|