• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to imlement Abstract factory using enum?

Siegfried Heintze
Ranch Hand
Posts: 408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
[ February 03, 2008: Message edited by: Siegfried Heintze ]
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic