title: Handling Enum values from different enums that implement a certain interface in a switch/case
body: <p>I have an empty interface <code>Units</code> that I'm using to tag different <code>enums</code> so I know that they hold different units (e.g. I have an <code>enum TemperatureUnits implements Units{}</code> that stores Fahrenheit, Celsius, etc., then I have a <code>DistanceUnits</code> that holds Meters, Feet, etc.</p>
  
  <p>I want to do different things in a switch/case based on which <code>enum</code> value is passed to a method.  I want it to accept a value from any <code>enum</code> that implements <code>Units</code>.  The problem is that, since the <code>enums</code> are actually different classes, I have to use the qualified name of the value in the switch/case.  My code looks something like this:</p>
  
  <pre><code>     public static void foo(Units units){ //units has to be an enum that implements Units
  
          switch (units){
              case TemperatureUnits.FAHRENHEIT: //I can't say just FAHRENHEIT, because Units itself doesn't 
                  //have a FAHRENHEIT value, but it won't let me say TemperatureUnits.FAHRENHEIT because it won't let use
                  // qualified enum values as cases.
                  //Do stuff
                  break;
              case DistanceUnits.METERS:
                  //Do other stuff
                  break;
              //...etc
  </code></pre>
  
  <p>How would I have a switch/case statement that can use values from different <code>enums</code>?</p>
  
  <p>Edit: My <code>Units</code> interface is just:</p>
  
  <pre><code>public interface Units{
      String getLabel();
  }
  </code></pre>