aspose file tools*
The moose likes Beginning Java and the fly likes How to imlement Abstract factory using enum? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to imlement Abstract factory using enum?" Watch "How to imlement Abstract factory using enum?" New topic
Author

How to imlement Abstract factory using enum?

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to imlement Abstract factory using enum?