title: java enum getter setter
body: <p>I'm consuming data from web service, will be storing that data into data holder classes and then get that data at some other place.</p>
  
  <p>For a particular field, most suitable data type is enum and hence I've created following enum:</p>
  
  <pre><code>public enum EventStatus {
      PENDING(1), OPEN(2), DISPATCHED(3), APPENDED(4), CLOSED(5), REQUESTED_TO_CLOSE(
              6), ACTION_REQUESTED_FROM_POLICE_STATION(7), ACTION_REQUESTED_FROMD_ISPATCHER(
              8), ACTION_REQUESTED_FROM_SUPERVISOR(9);
      private int value;
  
      private EventStatus(int value) {
          this.value = value;
      }
  
      public int getValue() {
          return value;
      }
      //Just for testing from some SO answers, but no use
      public void setValue(int value) {
          this.value = value;
      }
  }
  </code></pre>
  
  <p>This enum is used within another class as follows:</p>
  
  <pre><code>public EventStatus getEventStatus() {
      return eventStatus;
  }
  
  public void setEventStatus(EventStatus eventStatus) {
      this.eventStatus = eventStatus;
  }
  </code></pre>
  
  <p>Now when I try to set value like following:</p>
  
  <pre><code>event.setEventStatus(getAttributeValueInt(linkedEventElement, "status"));
  </code></pre>
  
  <p>which equivalents to</p>
  
  <pre><code>event.setEventStatus(1);
  </code></pre>
  
  <p>I'm getting compilation error that <em>method is not applicable for arguments(int)</em></p>
  
  <p>One way I can do this is by something like this:</p>
  
  <pre><code>switch(getAttributeValueInt(linkedEventElement, "status")){
     case 1:eventLinkedEvent.setEventStatus(EventStatus.PENDING); 
        //and so on...
  }
  </code></pre>
  
  <p>But this ruins the sole purpose of enum.</p>
  
  <p>Also how to get event status value in integer form?</p>
  
  <p>Can anyone please guide me how to go ahead?</p>