Here you can find the source of valueOf(final Class
public static <E extends Enum<E>> E valueOf(final Class<E> clazz, final String name)
//package com.java2s; //License from project: Apache License public class Main { public static <E extends Enum<E>> E valueOf(final Class<E> clazz, final String name) { if (clazz == null) { return null; }//from www. j av a2s . co m final E[] es = clazz.getEnumConstants(); for (final E e : es) { if (e.name().equalsIgnoreCase(name)) { return e; } } return null; } }