public < T extends Enum < T > > T lookupEnum ( Class < T > type , String name ) { if ( type == null ) { throw new IllegalArgumentException ( "type must not be null" ) ; } if ( name == null ) { throw new IllegalArgumentException ( "name must not be null" ) ; } Map < String , Enum < ? > > map = getEnumRenames ( type ) ; Enum < ? > value = map . get ( name ) ; if ( value != null ) { return type . cast ( value ) ; } return Enum . valueOf ( type , name ) ; }
Lookup an enum from a name handling renames .