@ SuppressWarnings ( "unchecked" ) public static < E extends Enum < ? extends Style . HasCssName > > E fromStyleName ( final String styleName , final Class < E > enumClass , final E defaultValue ) { if ( styleName == null || enumClass == null ) { return defaultValue ; } for ( final Enum < ? extends Style . HasCssName > constant : enumClass . getEnumConstants ( ) ) { final Style . HasCssName anEnum = ( Style . HasCssName ) constant ; final String cssClass = anEnum . getCssName ( ) ; if ( cssClass != null && StyleHelper . containsStyle ( styleName , cssClass ) ) { return ( E ) anEnum ; } } return defaultValue ; }
Returns first enum constant found in at space - separated list of style names .