Java String to ConvertStringToEnumValue(String enumAsString, Class type)

Here you can find the source of ConvertStringToEnumValue(String enumAsString, Class type)

Description

Convert String To Enum Value

License

Open Source License

Declaration

public static <E extends Enum<E>> E ConvertStringToEnumValue(String enumAsString, Class<E> type) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static <E extends Enum<E>> E ConvertStringToEnumValue(String enumAsString, Class<E> type) {
        E userType = Enum.valueOf(type, enumAsString.toUpperCase());

        return userType;
    }/*  w  w w  . j  a  va  2 s. c  o m*/
}

Related

  1. convertStringArrayToString(String[] value, String separator)
  2. convertStringFormat(String property)
  3. convertStringsToTextSet(String[] values)
  4. convertStringToArray(String str)
  5. convertStringToColor(String color)
  6. convertStringToFloat(String str)
  7. convertStringToId(String s)
  8. convertStringToIntDef(String string, int defaultValue)
  9. convertStringToLiteral(String className, String value)