Yeah, this is a pain with xstream and that it doesn't use a default
constructor when creating an object. As gabriel says i think the only way
to centralize that logic would be in readResolve(). Probably never became a
big issue because I don't believe the ServiceFactoryExtension is used all
that much?


On Tue, Sep 10, 2013 at 8:20 AM, Gabriel Roldan <[email protected]> wrote:

> I have the feeling that that approach was taken before XStream supported
> the readResolve() initialization.
> A pattern I used sometimes for xstream classes is like this:
> public class ModelObject{
>
>   public ModelObject(){
>      readResolve();
>   }
>
>   private Object readResolve(){
>     //initialize instance variables to default values...
>     return this;
>   }
> }
>
>
>
> On Mon, Sep 9, 2013 at 8:09 PM, Kevin Smith <[email protected]> wrote:
>
>> While working on GEOS-6010 I've taken a look at the XStreamServiceLoader
>> and ServiceFactoryExtension classes and their children.
>>
>> It seems like the two overlap in their ability to create new ServiceInfo
>> objects.
>>
>>  XStreamServiceLoader and its subclasses are replacing a bunch of nulls
>> with default values when deserializing.  If those properties should be
>> non-null, then it seems like they should be set to their defaults when a
>> new service is created as well as when being deserialized.
>>
>> Am I missing something about why it's set up like this or is this just a
>> case of someone reinventing the wheel?
>>
>> --
>> Kevin Smith
>> Junior Software Developer, OpenGeo
>> <[email protected]>
>>
>>
>> ------------------------------------------------------------------------------
>> How ServiceNow helps IT people transform IT departments:
>> 1. Consolidate legacy IT systems to a single system of record for IT
>> 2. Standardize and globalize service processes across IT
>> 3. Implement zero-touch automation to replace manual, redundant tasks
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Geoserver-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>>
>>
>
>
> --
> Gabriel Roldan
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
>
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT
> 2. Standardize and globalize service processes across IT
> 3. Implement zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> _______________________________________________
> Geoserver-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>
>


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to