public static < T extends Enum < T > > T getEnumFromString ( Class < T > c , String string ) { if ( c != null && string != null ) { return Enum . valueOf ( c , string . trim ( ) . toUpperCase ( ) ) ; } return null ; }
A common method for all enums since they can t have another base class