Using nested enum types in Java
I have a data structure in mind that involves nested enums, such that I could do something like the following: Drink.COFFEE.getGroupName(); Drink.COFFEE.COLUMBIAN.getLabel(); And if there were method declarations: someMethod(Drink type) someOtherMethod(DrinkTypeInterface type) Then I could say (appropriately): someMethod(Drink.COFFEE) someOtherMethod(Drink.COFFEE.COLUMBIAN) This is what I came up with: public enum Drink { COFFEE("Coffee"); private String groupName; private Drink(String groupName) { this.groupName = groupName; } public enum Coffee implements DrinkTypeInterface { COLUMBIAN(