Re: Elements

View: New views
2 Messages — Rating Filter:   Alert me  

Re: Elements

by Niall Gallagher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Just use the read method that takes an object.

MyRootObject obj = new MyRootObjectInstance();
myObjectInstance = Serializer.read(myObjectInstance, inputStream);

This will work.

Niall

--- On Mon, 9/7/09, Håkon Evensen <haakon.evensen@...> wrote:

> From: Håkon Evensen <haakon.evensen@...>
> Subject: [Simple-support] Elements
> To: simple-support@....
> Date: Monday, September 7, 2009, 2:13 AM
> Hi,
>
> Are there any way to make the deserialization not
> instantiate an object.
>
> Ex:
>
> class MyRootObject {
>    @Element
>    MySubObject sub;
>
>    MyRootObject() {
>      sub = new MySubObject();
>    }
> }
> (MySubObject has serialize annotations)
>
> If i deserialize into MyRootObject, it will replace
> MySubObject.  Is it 
> possible to keep the existing object, but still deserialize
> the subobject?
>
> Is the Strategy interface a place to start?
>
> Thank you!
>
> Regars
> Haakon
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day
> trial. Simplify your report design, integration and
> deployment - and focus on
> what you do best, core application coding. Discover what's
> new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Simple-support mailing list
> Simple-support@...
> https://lists.sourceforge.net/lists/listinfo/simple-support
>


     

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Simple-support mailing list
Simple-support@...
https://lists.sourceforge.net/lists/listinfo/simple-support

Re: Elements

by Håkon Evensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you, but the question was how to stop it from new'ing the subobject,  
or any subobject.

 From the source example the 'sub' is created in MyRootObject constructor.  
The deserializer will later replace this object, and my question is if it  
is possible to force it to just use the object already there, instead of  
replacing it.

Regards,
Haakon





On Sat, 12 Sep 2009 15:08:19 +0200, Niall Gallagher  
<gallagher_niall@...> wrote:

> Hi,
>
> Just use the read method that takes an object.
>
> MyRootObject obj = new MyRootObjectInstance();
> myObjectInstance = Serializer.read(myObjectInstance, inputStream);
>
> This will work.
>
> Niall
>
> --- On Mon, 9/7/09, Håkon Evensen <haakon.evensen@...> wrote:
>
>> From: Håkon Evensen <haakon.evensen@...>
>> Subject: [Simple-support] Elements
>> To: simple-support@....
>> Date: Monday, September 7, 2009, 2:13 AM
>> Hi,
>>
>> Are there any way to make the deserialization not
>> instantiate an object.
>>
>> Ex:
>>
>> class MyRootObject {
>>    @Element
>>    MySubObject sub;
>>
>>    MyRootObject() {
>>      sub = new MySubObject();
>>    }
>> }
>> (MySubObject has serialize annotations)
>>
>> If i deserialize into MyRootObject, it will replace
>> MySubObject.  Is it 
>> possible to keep the existing object, but still deserialize
>> the subobject?
>>
>> Is the Strategy interface a place to start?
>>
>> Thank you!
>>
>> Regars
>> Haakon
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal
>> Reports 2008 30-Day
>> trial. Simplify your report design, integration and
>> deployment - and focus on
>> what you do best, core application coding. Discover what's
>> new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Simple-support mailing list
>> Simple-support@...
>> https://lists.sourceforge.net/lists/listinfo/simple-support
>>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Simple-support mailing list
> Simple-support@...
> https://lists.sourceforge.net/lists/listinfo/simple-support



------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Simple-support mailing list
Simple-support@...
https://lists.sourceforge.net/lists/listinfo/simple-support