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

com.lordofthejars.nosqlunit.marklogic.content.Content Maven / Gradle / Ivy

The newest version!
package com.lordofthejars.nosqlunit.marklogic.content;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;

public abstract class Content {

    private static final String[] EMPTY_STRING_ARRAY = new String[0];

    private String uri;

    private Set collections = new HashSet<>();

    protected Content() {
    }

    protected Content(Set collections) {
        this.collections.addAll(collections);
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String[] getCollections() {
        return collections.toArray(EMPTY_STRING_ARRAY);
    }

    public void addCollection(String collection) {
        collections.add(collection);
    }

    public abstract InputStream content() throws IOException;

    public abstract D getData();

    @Override
    public String toString() {
        return "Content{" +
                "uri='" + uri + '\'' +
                ", collections=" + collections +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy