Professional Documents
Culture Documents
Hierarchical Structures With Java Enums
Hierarchical Structures With Java Enums
11/10/2010 20:29 1 de 2
I love Enums. There are a lot of use cases, where they become really handy. Especially since I have
learned that you can override methods in enums…
Some days ago Alexander Radzin came up with another nice idea ( http://alexradzin.blogspot.com/2010/10
/hierarchical-structures-with-java-enums_05.html ) : He created a hierarchical structure using enums. The
idea is very simple: Just add a reference to the parent to your enum.
While the idea is really nice, the implementation seems to be a little bit too complicated. I think using
reflection is not a very nice thing at all. Therefore I have modified his implementation.
And this is the idea. That idea has a lot of potential – I am sure I will find a lot of nice use cases…
http://blog.cedarsoft.com/2010/10/hierarchical-structures-with-java-enums/
Hierarchical structures with Java ... 11/10/2010 20:29 2 de 2
return parent.supportsXWindowSystem();
}
}
http://blog.cedarsoft.com/2010/10/hierarchical-structures-with-java-enums/