class BaseExtensionUtils {

    @SuppressWarnings( "unchecked" )
    protected static void setStringValue( @Nonnull String url, @Nonnull IBaseHasExtensions resource, @Nullable String value, @Nonnull Function<String, IElement> typeFactory )
    {
        resource.getExtension().removeIf( e -> url.equals( e.getUrl() ) );

        if ( value != null )
        {
            final IBaseExtension<?, ?> extension = resource.addExtension();

            extension.setUrl( url );
            extension.setValue( ( (IPrimitiveType<String>) typeFactory.apply( "string" ) ).setValue( value ) );
        }
    }

    private  BaseExtensionUtils();

}