public static < T extends Enum < T > > T getEnum ( Class < T > enumClass , AbstractConfig config , String key ) { Preconditions . checkNotNull ( enumClass , "enumClass cannot be null" ) ; Preconditions . checkState ( enumClass . isEnum ( ) , "enumClass must be an enum." ) ; String textValue = config . getString ( key ) ; return Enum . valueOf ( enumClass , textValue ) ; }
Method is used to return an enum value from a given string .