1 package org.kuali.common.devops.jenkins.updates.model; 2 3 import org.kuali.common.core.build.ValidatingBuilder; 4 import org.kuali.common.core.validate.annotation.IdiotProofImmutable; 5 6 import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 7 8 @IdiotProofImmutable 9 @JsonDeserialize(builder = JenkinsPluginDependency.Builder.class) 10 public final class JenkinsPluginDependency { 11 12 private final String name; 13 private final boolean optional; 14 private final String version; 15 16 private JenkinsPluginDependency(Builder builder) { 17 this.name = builder.name; 18 this.optional = builder.optional; 19 this.version = builder.version; 20 } 21 22 public static Builder builder() { 23 return new Builder(); 24 } 25 26 public static class Builder extends ValidatingBuilder<JenkinsPluginDependency> { 27 28 private String name; 29 private boolean optional; 30 private String version; 31 32 public Builder withName(String name) { 33 this.name = name; 34 return this; 35 } 36 37 public Builder withOptional(boolean optional) { 38 this.optional = optional; 39 return this; 40 } 41 42 public Builder withVersion(String version) { 43 this.version = version; 44 return this; 45 } 46 47 @Override 48 public JenkinsPluginDependency build() { 49 return validate(new JenkinsPluginDependency(this)); 50 } 51 } 52 53 public String getName() { 54 return name; 55 } 56 57 public boolean isOptional() { 58 return optional; 59 } 60 61 public String getVersion() { 62 return version; 63 } 64 65 }