1 package org.kuali.common.devops.archive.sweep.jenkins.s3; 2 3 import static com.google.common.collect.Lists.newArrayList; 4 5 import java.util.List; 6 7 import org.kuali.common.core.build.ValidatingBuilder; 8 import org.kuali.common.core.validate.annotation.IdiotProofImmutable; 9 10 import com.google.common.collect.ImmutableList; 11 12 @IdiotProofImmutable 13 public final class JenkinsS3Job { 14 15 private final String name; 16 private final S3ObjectPair pair; 17 private final ImmutableList<JenkinsS3Build> builds; 18 19 private JenkinsS3Job(Builder builder) { 20 this.name = builder.name; 21 this.pair = builder.pair; 22 this.builds = ImmutableList.copyOf(builder.builds); 23 } 24 25 public static Builder builder() { 26 return new Builder(); 27 } 28 29 public static class Builder extends ValidatingBuilder<JenkinsS3Job> { 30 31 private String name; 32 private S3ObjectPair pair; 33 private List<JenkinsS3Build> builds = newArrayList(); 34 35 public Builder withName(String name) { 36 this.name = name; 37 return this; 38 } 39 40 public Builder withPair(S3ObjectPair pair) { 41 this.pair = pair; 42 return this; 43 } 44 45 public Builder withBuilds(List<JenkinsS3Build> builds) { 46 this.builds = builds; 47 return this; 48 } 49 50 @Override 51 public JenkinsS3Job build() { 52 return validate(new JenkinsS3Job(this)); 53 } 54 } 55 56 public String getName() { 57 return name; 58 } 59 60 public S3ObjectPair getPair() { 61 return pair; 62 } 63 64 public List<JenkinsS3Build> getBuilds() { 65 return builds; 66 } 67 68 }