title: How to pass an enumeration as a parameter to a function?
body: <p>Is there a clean way of passing an enumeration CLASS to a function?</p>
  
  <p>Consider something like this:</p>
  
  <pre><code>public enum MyEnum implements XYZ {
  
     //enum values
     A,
     B,
     C;
  }
  
  public void getEnumeration(final Class&lt;? extends XYZ&gt; myEnum) {
  
     //go through enumeration
     for (XYZ xyz : myEnum.getEnumConstants()
         System.out.println(xyz.toString());
  }
  </code></pre>
  
  <p>enumeration passed in as follows:</p>
  
  <pre><code>getFunction(MyEnum.class);
  </code></pre>
  
  <p>now... the above works and I can pass my enumeration to the <code>getEnumeration()</code> function just fine. HOWEVER, I'd like to ensure that what I am passing in is indeed an enumeration and not any class that implements <code>XYZ</code>. <strong>I realize that enumeration is a type of class</strong>, but is there a way to strong type this such that the compiler would pick it up if I pass in a class that implement <code>XYZ</code> instead of enumeration that implements <code>XYZ</code>?</p>