• 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

changing enum content...

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an enumeration (say Letters) that I use in GUI classes. (especially in comboboxes).

Until now, everything was fine, but now, I need two executables of my application and

each will use this enum with different contents. for example:

enum Letters{A, B, C} --- application 1
enum Letters {A, B, D, E, F} ---- application 2

Can I achieve to change contents of the Letters without changing the GUI code???
How?

thank you.


 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hate to say this, but if your enum is not a fixed set, but it's a set that can vary between applications....then it probably shouldn't be an enum. It should probably be a conventional class that is loaded from a config file or a database.

Other than that, the key thing would be to make sure that your GUI was never referring to specific values of the enum. For example, if it was only ever getting the values using the values() method of the enum class, then it's going to be easier to swap in a different class definition.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic