Andreas,

Without a factory in the RendererManager class you have to have the
following.

if (object instanceof Layer) {
   return new LayerRenderer(...);
} else if (object instanceof WMSLayer) {
  return new WMSLayerRenderer();
}

with the factory it becomes

RendererFactory factory = getRenderer(object.getClass);
if (factory != null) {
  return factory.create(...)
}

Which is a lot more extensible than hard coding .

Outside the this method factories aren't necessarily needed.

Paul

Andreas Schmitz wrote:
> Paul Austin wrote:
>
> Hi,
>
>   
>> I was thinking that we could clean up this code a little, at the moment
>> there is hard coded implementations for layers and WMS layers. We could
>> change this to use a factory approach by creating implementations for these.
>>
>> There are actually a whole bunch of places we could do this including
>> the tree view panel.
>>
>> Any objections if I gradually move over to using a factory based approach?
>>     
>
> I don't see the advantage here. If you use a factory, you'll choose the
> implementation you want from the factory. If you don't, you'll just choose the
> implementation. Eg:
>
> WMSLayer layer = new WMSLayer(blah, blubb);
>
> vs
>
> WMSLayer layer = LayerFactory.createWMSLayer(blah, blubb);
>
> Best regards, Andreas
> --
> l a t / l o n  GmbH
> Aennchenstrasse 19           53177 Bonn, Germany
> phone ++49 +228 18496-11     fax ++49 +228 1849629
> http://www.lat-lon.de        http://www.deegree.org
>
>   
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> ------------------------------------------------------------------------
>
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>   


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to