Java String Value Of valueOf(final Class clazz, final String name)

Here you can find the source of valueOf(final Class clazz, final String name)

Description

value Of

License

Apache License

Declaration

public static <E extends Enum<E>> E valueOf(final Class<E> clazz, final String name) 

Method Source Code

//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;
    }
}

Related

  1. valueOf(Class enumType, String name)
  2. valueOf(Class enumType, String name)
  3. valueOf(Class enumType, String name, T defaultValue)
  4. valueOf(final Class enumType, final String value)
  5. valueOf(final Class type, final String value)
  6. valueOf(final Class enumType, final String name)
  7. valueOf(final Object obj, final String defaultValue)
  8. valueOf(Object object, String defaultEmptyValue)
  9. valueOf(String boolStr)