Equivalent to {@link #getEnum(String, Class, Enum)
getEnum}{@code (key, enumClass, null)}.
433109
public <TEnum extends Enum<TEnum>> TEnum getEnum(String key, Class<TEnum> enumClass)
    {
        return getEnum(key, enumClass, null);
    }
1087905
@Nullable
  public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameOrNull (@Nonnull final Class <ENUMTYPE> aClass,
                                                                                          @Nullable final String sName)
  {
    return getFromNameOrDefault (aClass, sName, null);
  }
133636
@CheckResult @NonNull
  public <T extends Enum<T>> Preference<T> getEnum(@NonNull String key, @NonNull T defaultValue,
      @NonNull Class<T> enumClass) {
    checkNotNull(key, "key == null");
    checkNotNull(defaultValue, "defaultValue == null");
    checkNotNull(enumClass, "enumClass == null");
    return new RealPreference<>(preferences, key, defaultValue, new EnumAdapter<>(enumClass), keyChanges);
  }
720970
static Class<?> getKeyTypeFromEnumMap(Object enumMap)
    {
        if(__keyTypeFromEnumMap == null)
        {
            throw new RuntimeException("Could not access (reflection) the private " +
                    "field *keyType* (enumClass) from: class java.util.EnumMap");
        }
        
        try
        {
            return (Class<?>)__keyTypeFromEnumMap.get(enumMap);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
    }
1320710
public static ResourceKey key(Enum<?> enumValue, String key) {
        return new ResourceKey(enumValue.getClass().getName(), enumValue.name()).child(key);
    }
596224
public static final<E extends Enum> E getEnumValue(String str, Class<E> enumClass) {
        str = str.trim();
        if (StringUtils.isBlank(str)) return null;
        for (E e : enumClass.getEnumConstants()) {
            if (e.toString().equalsIgnoreCase(str)) return e;
        }
        throw new IllegalArgumentException("Invalid enum string provided for ["+enumClass+"]: " + str);
    }
675887
def get(cls, key):
        
        if isinstance(key, Enum) and not isinstance(key, cls):
            raise TypeError("Cannot type cast between enums")
        if isinstance(key, int):
            if not int(key) in cls._values:
                raise KeyError("There is no enum with key %d" % key)
            return cls._values[key]
        if isinstance(key, (str, unicode)):
            if not key in cls._names:
                raise KeyError("There is no enum with name %s" % key)
            return cls._names[key]
        raise TypeError("Invalid enum key type: %s"
                         % (key.__class__.__name__))
359010
public static Object[] getEnumValues(Class<? extends Enum<?>> clazz) {
		Object[] enums=clazz.getEnumConstants();
		if (enums == null) {
			Method[] mthds = clazz.getDeclaredMethods();
			Method mthd = null;
			for (Method mth : mthds) {
				if (mth.getName().equals("values")) {
					mthd = mth;
					break;
				}
			}
			if (mthd != null)
				try {
					enums = (Object[]) mthd.invoke(null);
				} catch (Throwable e) {
					throw new RuntimeException(e);
				}
		}
		return enums;
	}
1136755
public static Object getEnumConstantByName(Class klass, String name) {
    name = name.toUpperCase();
    Object c[] = klass.getEnumConstants();
    for (int ix = 0; ix < c.length; ix++)
      if (c[ix].toString().equals(name))
        return c[ix];
    throw new DukeConfigException("No such " + klass + ": '" + name + "'");
  }
26087
@SuppressWarnings({ "unchecked", "rawtypes" })
	private static Set<Class<? extends Enum<?>>> listupEnumClasses(final String packageName) {
		String resourceName = packageName.replace('.', '/');
		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
		List<URL> roots;
		try {
			roots = Collections.list(classLoader.getResources(resourceName));
		} catch (IOException e) {
			LOG.error(e.getMessage(), e);
			return Collections.emptySet();
		}

		Set<Class<?>> classes = new HashSet<>();
		for (URL root : roots) {
			if ("file".equalsIgnoreCase(root.getProtocol())) {
				try {
					classes.addAll(findEnumClassesWithFile(packageName, Paths.get(root.toURI())));
				} catch (URISyntaxException e) {
					LOG.error(e.getMessage(), e);
				}
			}
			if ("jar".equalsIgnoreCase(root.getProtocol())) {
				try (JarFile jarFile = ((JarURLConnection) root.openConnection()).getJarFile()) {
					classes.addAll(findEnumClassesWithJar(packageName, jarFile));
				} catch (IOException e) {
					LOG.error(e.getMessage(), e);
				}
			}
		}

		return (Set) classes;
	}
100544
public String getStringValue(Enum key) {
    if (this._task.get(key) == null) {
      return "";
    } else {
     return this._task.get(key);
    }
  }
456152
@Nullable
  public static <T extends Enum<T>> T getEnumIfPresent(final Class<T> enumClass, final String value)
  {
    Preconditions.checkNotNull(enumClass, "enumClass");
    Preconditions.checkNotNull(value, "value");

    for (T enumValue : enumClass.getEnumConstants()) {
      if (enumValue.name().equals(value)) {
        return enumValue;
      }
    }

    return null;
  }
483961
public EnumConstant getConstant(String name) {
        for (EnumConstant enumConstant : getConstants()) {
            if (enumConstant.getName().equals(name)) {
                return enumConstant;
            }
        }
        return null;
    }
1235316
public static <E extends Enum<E>> E asEnum(ModelNode value, Class<E> targetClass) {
        return asEnum(value, targetClass, null);
    }
923244
public static String getEnumName(Enum[] e, int value) {
        if (e != null) {
            int toCompareValue;
            for (Enum en : e) {
                if (en instanceof EnumReadable) {
                    toCompareValue = ((EnumReadable) en).value();
                } else {
                    toCompareValue = en.ordinal();
                }
                if (value == toCompareValue) {
                    return en.name();
                }
            }
        }
        return "";
    }
924520
public static <T extends Enum<T>> T getEnumValue(Class<T> enumType,
            String name) {
        if (StringUtils.isEmpty(name)) {
            return null;
        }
        
        try {
            T v = Enum.valueOf(enumType, name);
            return v;
        } catch (IllegalArgumentException e) {
            return null;
        }
    }
518702
private static Map<String, Object> getEnumNamesMap(Class<? extends Enum<?>> enumType) {
		final String sourceMethod = "getEnumNameMap"; //$NON-NLS-1$
		final boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(sourceClass, sourceMethod, new Object[]{enumType});
		}
		Map<String, Object> result = new HashMap<String, Object>();
		Enum<?>[] values = enumType.getEnumConstants();
		for (Enum<?> value : values) {
			result.put(value.name(), value);
		}
		if (isTraceLogging) {
			log.exiting(sourceMethod, sourceMethod, result);
		}
		return result;
	}