0 Replies Latest reply: Sep 24, 2013 1:30 PM by meandmycode RSS

    How to get class and use method on it




      class State {


              String name

              Enum expectedValue


              public State(String name,Enum expectedValue){

                  this.name = name;

                  this.expectedValue = expectedValue;







      In the same class I need to have a method that takes a String and it should return matching

      Enum value. Since  class already have the expectedValue my idea is to get the Enum class ( using that if possible) and

      the call get() on it see my example below;




      expectedValue is HwState.UPGRADED;


          public HwState convertActualToStateType( String actual){

              return  HwState.get(Integer.valueOf(actual));



      How can I get the Enum class (HwState) ? And then use it e.g. HwState.get() ?