title: Java enum: Return value other than String
body: <p>I can't find an answer to this question anywhere so I'm hoping someone can help me out. I'm expecting that what I am asking is not possible, but I wanted to confirm. First, an enum example...</p>
  
  <pre><code>public enum StatusCode {
  
      SUCCESS(0), GENERAL_ERROR(999), CONNECTION_TIMEOUT_ERROR(1337);
  
      private int statusCode;
  
      private StatusCode(int statusCode) {
          this.statusCode = statusCode;
      }
  
      public int getStatusCode() {
          return statusCode;
      }
  }
  </code></pre>
  
  <p>As you can see, I am using this enum to force specific status codes. My question is this: Is there a way that I can reference StatusCode.SUCCESS and have it return the int value associated with it? Rather than get into too much detail about what I would like to do, take this example:</p>
  
  <pre><code>public String getStatusMessage(int statusCode) {
      // Map&lt;Integer, String&gt; that contains status messages
      // return String for key statusCode
  }
  </code></pre>
  
  <p>In this example, the syntax for calling this method is <code>getStatusMessage(StatusCode.SUCCESS.getStatusCode())</code>.</p>
  
  <p>Is there a way to shorten this to <code>getStatusMessage(StatusCode.SUCCESS)</code>?</p>
  
  <p>I think the second way looks much cleaner and would make my code much more readable. Any ideas? Any help is much appreciated. Thanks in advance!</p>