@ SuppressWarnings ( "unchecked" ) protected static < T extends ExpandableStringEnum < T > > T fromString ( String name , Class < T > clazz ) { if ( name == null ) { return null ; } else if ( valuesByName != null ) { T value = ( T ) valuesByName . get ( uniqueKey ( clazz , name ) ) ; if ( value != null ) { return value ; } } try { T value = clazz . newInstance ( ) ; return value . withNameValue ( name , value , clazz ) ; } catch ( InstantiationException | IllegalAccessException e ) { return null ; } }
Creates an instance of the specific expandable string enum from a String .