class NameUtils {

    @Nonnull
    public static <T extends Enum<T>> T toEnumValue( @Nonnull Class<T> enumClass, @Nullable Object value ) throws IllegalArgumentException
    {
        final String stringValue = toEnumName( value );
        if ( stringValue == null )
        {
            throw new IllegalArgumentException( "Null enum values are not allowed" );
        }
        return Enum.valueOf( enumClass, stringValue );
    }

    private  NameUtils();

}