Here you can find the source of valueOf(String s, Class
public static <E extends Enum<E>> E valueOf(String s, Class<E> e)
//package com.java2s; //License from project: Open Source License public class Main { public static <E extends Enum<E>> E valueOf(String s, Class<E> e) { try {// w w w. j a v a 2 s. com return Enum.valueOf(e, s); } catch (IllegalArgumentException ex) { ex.printStackTrace(); } return null; } }