0 Replies Latest reply on Sep 24, 2013 6:30 PM by meandmycode

    How to get class and use method on it

    meandmycode

      Hi,

       

      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;

       

      Example:

       

      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() ?

       

       

      //mike