All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.vespa.schemals.common.editbuilder.TextDocumentEditBuilder Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
package ai.vespa.schemals.common.editbuilder;

import java.util.ArrayList;

import org.eclipse.lsp4j.TextDocumentEdit;
import org.eclipse.lsp4j.TextEdit;
import org.eclipse.lsp4j.VersionedTextDocumentIdentifier;

public class TextDocumentEditBuilder {
    private ArrayList textEdits;
    private VersionedTextDocumentIdentifier versionedTextDocumentIdentifier;

    public TextDocumentEditBuilder() {
        this.versionedTextDocumentIdentifier = new VersionedTextDocumentIdentifier();
        textEdits = new ArrayList<>();
    }

    public TextDocumentEditBuilder setVersionedTextDocumentIdentifier(VersionedTextDocumentIdentifier identifier) {
        this.versionedTextDocumentIdentifier = identifier;
        return this;
    }

    public TextDocumentEditBuilder setFileURI(String fileURI) {
        this.versionedTextDocumentIdentifier.setUri(fileURI);
        return this;
    }

    public TextDocumentEditBuilder addEdit(TextEdit textEdit) {
        textEdits.add(textEdit);
        return this;
    }

    public String getFileURI() {
        return versionedTextDocumentIdentifier.getUri();
    }

    public TextDocumentEdit build() {
        return new TextDocumentEdit(versionedTextDocumentIdentifier, textEdits);
    }

    public String toString() {
        return "DocumentEdits(" + versionedTextDocumentIdentifier.getUri() + " : " + 
            (versionedTextDocumentIdentifier.getVersion() == null ? "" : versionedTextDocumentIdentifier.getVersion())
            + " : " + textEdits.size();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy