title: How to use enum with grouping and subgrouping hierarchy/nesting
body: <p>I have one <code>enum</code> 'class' called <code>Example</code> as follows:</p>
  
  <pre><code>enum Example {
  //enums belonging to group A:
     enumA1,
     enumA2,
     enumA3,
  //enums belonging to group B:
     enumB1,
     enumB2,
     enumB3,
  //enums belonging to group C:
     enumC1,
     enumC2,
     enumC3;
  }
  </code></pre>
  
  <p>It's important for my project they all enums I work with belong to <code>Example</code> (since this is an argument in a constructor of a class). </p>
  
  <p>How do I use <code>enum</code> hierarchy/nesting in order to achieve the following:</p>
  
  <ul>
  <li><p>A method that tests whether an <code>enum</code> is of group A, B or C. For example, something like <code>Example.enumA1.isGroupBelonging(Group.A)</code> or <code>isGroupBelonging(Example.enumA1,Group.A)</code> would be a public method that returns true.</p></li>
  <li><p>Be able to do the same thing with sub-groups of group <code>A</code>, <code>B</code> and <code>C</code>. For example, group A might have subgroups <code>a</code>, <code>b</code> and <code>c</code>. I then want a method that does something such as <code>Example.enumA1.isSubGroupBelonging(SubGroup.a)</code> which is a <code>public boolean</code>.</p></li>
  <li><p>A way to do all this without needing to have some elaborate <code>enum</code> name that clogs up my code. For example, it would be nice to just be able to refer to <code>Example.enumA1</code> throughout my other classes without needing to refer to it using something like <code>Example.enumA1(Group.A,SubGroup.a)</code> or <code>Example.enumA1.Group.A.SubGroup.a</code></p></li>
  </ul>