This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using generics with enums

 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a use case of an enum A, that has 4 values & these 4 values maps to 4 different emums , so that i can access the values of those enums

E.g:

I can do A.Value_1.getMappedEnum().Value_1.1

or A.Value_2.getMappedEnum().Value_2.2

I feel this can be achieved by using generics + enums. I have not succeeded in doing so.
My source of truth is http://madbean.com/2004/mb2004-3/ & http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#FAQ106.


Could anyone please help me in achieving this.


Regards,
Sumit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic