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

io.searchbox.snapshot.GetSnapshotRepository Maven / Gradle / Ivy

package io.searchbox.snapshot;

import org.apache.commons.lang3.StringUtils;

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @author happyprg([email protected])
 */
public class GetSnapshotRepository extends AbstractSnapshotRepositoryAction {

    protected GetSnapshotRepository(Builder builder) {
        super(builder);
    }

    @Override
    public String getRestMethodName() {
        return "GET";
    }

    public static class Builder extends AbstractSnapshotRepositoryAction.RepositoryBuilder {
        private Set repositories = new LinkedHashSet();

        public Builder() {
        }

        public Builder(String repository) {
            this.repositories.add(repository);
        }

        public Builder(Collection repositories) {
            this.repositories.addAll(repositories);
        }

        public Builder addRepository(Collection repositories) {
            this.repositories.addAll(repositories);
            return this;
        }

        @Override
        public GetSnapshotRepository build() {
            return new GetSnapshotRepository(this);
        }

        @Override
        protected String getRepositories() {
            if (repositories.isEmpty()) {
                return "_all";
            } else {
                return StringUtils.join(repositories, ",");
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy