It's not a secret anymore!
The moose likes Java in General and the fly likes Pattern: converters. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Pattern: converters." Watch "Pattern: converters." New topic
Author

Pattern: converters.

surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Hello Partners!
Please help with architectural decision.
I have 2 converters:

How to abstract from concrete converters to add new implementations in future?
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1541
    
    5

Hi surlac,

I'm not sure if I got your question properly, but (especially in case of converters), I would use Abstract-Factory pattern - that is - an abstract factory - which will create a concrete factory (XMLConverterFactory or JSONConverterFactory) which will further create relevant concrete objects (XMLConverter or JSONConverter).

To make it even better, I would use an interface for converter (which will be implemented by all converters), an interface for node and so on.

I hope this helps.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

Anayonkar Shivalkar wrote:
I'm not sure if I got your question properly, but (especially in case of converters), I would use Abstract-Factory pattern

You've got it right. Thanks for your advice.
So it can be used to load additional concrete converters from external jars, right? Separate from abstract factory jar.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Pattern: converters.
 
jQuery in Action, 3rd edition