• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to imlement Abstract factory using enum?

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
Thanks,
Siegfried
[ February 03, 2008: Message edited by: Siegfried Heintze ]
reply
    Bookmark Topic Watch Topic
  • New Topic