A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
Using generics with enums
sumit anand kumar
Ranch Hand
Joined: Apr 28, 2010
Posts: 82
posted
Sep 14, 2011 02:28:25
0
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:
-----------------Value 1.1 ------Value 1 -------Enum B------| A -| ---------------Value 1.2 ------Value 2------Enum C--------------------------------|--------Value 2.1 -------------------------Value 2.2
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
I agree. Here's the link:
http://aspose.com/file-tools
subject: Using generics with enums
Similar Threads
generics
Generics
Generics
generics
Generics
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter