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

org.jfrog.build.api.builder.dependency.BuildPatternArtifactsRequestBuilder Maven / Gradle / Ivy

There is a newer version: 2.41.23
Show newest version
package org.jfrog.build.api.builder.dependency;

import org.jfrog.build.api.dependency.BuildPatternArtifactsRequest;
import org.jfrog.build.api.dependency.Pattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jbaruch
 * @since 16/02/12
 */
public class BuildPatternArtifactsRequestBuilder {

    private String buildName;
    private String buildNumber;
    private String project;
    private boolean transitive;
    private List patterns;

    public BuildPatternArtifactsRequestBuilder() {
        patterns = new ArrayList<>();
    }

    public BuildPatternArtifactsRequest build() {
        if (buildName == null) {
            throw new IllegalArgumentException("BuildPatternArtifactsRequest must have a build name.");
        }
        if (buildNumber == null) {
            throw new IllegalArgumentException("BuildPatternArtifactsRequest must have a build number.");
        }

        BuildPatternArtifactsRequest request = new BuildPatternArtifactsRequest(buildName, buildNumber, project);
        request.setTransitive(transitive);
        request.setPatterns(patterns);
        return request;
    }

    public BuildPatternArtifactsRequestBuilder buildName(String buildName) {
        this.buildName = buildName;
        return this;
    }

    public BuildPatternArtifactsRequestBuilder buildNumber(String buildNumber) {
        this.buildNumber = buildNumber;
        return this;
    }

    public BuildPatternArtifactsRequestBuilder project(String project) {
        this.project = project;
        return this;
    }

    public BuildPatternArtifactsRequestBuilder pattern(String pattern) {
        patterns.add(new Pattern(pattern));
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy