A simple example of how to convert a String to an enum in Java.

public enum Blah {
  A("text1"),
  B("text2"),
  C("text3"),
  D("text4");

  private String text;

  Blah(String text) {
    this.text = text;
  }

  public String getText() {
    return this.text;
  }

  public static Blah fromString(String text) {
    if (text != null) {
      for (Blah b : Blah.values()) {
        if (text.equalsIgnoreCase(b.text)) {
          return b;
        }
      }
    }
    throw new IllegalArgumentException("No constant with text " + text + " found");
  }
}

The following code will output the enum “A”.

public class Main {
	public static void main(String[] args) {
		System.out.println(WorkflowStatus.fromString("text1"));
	}
}

ciao