Forums Register Login

How to imlement Abstract factory using enum?

+Pie Number of slices to send: Send
I have a combo box (SWT.DROP_DOWN) and I want to use it to implement the abstract factory or factory method pattern.

Presently I have created some enums and associate the enumeration values with strings via the combo box (see below).

The combo box contains instances of the following enum:


Then I switch on m_ParserType (several times).

I want to refactor this!

I don't know how to best use enums. Can enums help me implement the factory method pattern?


OK, so I just created the following interfaces and classes (


Now what did sun have in mind when they added enums to Java 1.5? Could I improve my design by using enums?
Thanks,
Siegfried
[ February 03, 2008: Message edited by: Siegfried Heintze ]
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2886 times.
Similar Threads
Restricting Sub-class declaration
Factory pattern(s)
A difficult OOD question...
Factory Vs Abstract Factory Pattern
Start java enum ordinal at 1 instead of 0
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 04:02:08.