title: switch case with enum class
body: <p>I have the following class:</p>
  
  <p>Topic.java</p>
  
  <pre><code>public enum Topic {
      CONFIG3("config3"), 
      CONFIG2("config2"),
      CONFIG1("config1")
      ;
  
      private String name = null;
  
      Topic(String name) {
          this.name = name;
      }
  
      public String getName() {
          return name;
      }
  }
  </code></pre>
  
  <p>When I'm trying to do something like this:</p>
  
  <pre><code>switch (topicName) {
      case Topic.CONFIG2.getName():
          // Do my stuff
          break;
  }
  </code></pre>
  
  <p>The compiler shows an error: <code>"Constant Expression required"</code>.</p>
  
  <p>Since the Topic class is already used by many users, I wonder if there is any way to keep it in the same structure but also get the topic value as a constant (in this case - config2).</p>
  
  <p>Any idea?</p>