001package org.kuali.common.devops.jenkins.updates.model; 002 003import org.kuali.common.core.build.ValidatingBuilder; 004import org.kuali.common.core.validate.annotation.IdiotProofImmutable; 005 006import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 007 008@IdiotProofImmutable 009@JsonDeserialize(builder = JenkinsPluginDependency.Builder.class) 010public final class JenkinsPluginDependency { 011 012 private final String name; 013 private final boolean optional; 014 private final String version; 015 016 private JenkinsPluginDependency(Builder builder) { 017 this.name = builder.name; 018 this.optional = builder.optional; 019 this.version = builder.version; 020 } 021 022 public static Builder builder() { 023 return new Builder(); 024 } 025 026 public static class Builder extends ValidatingBuilder<JenkinsPluginDependency> { 027 028 private String name; 029 private boolean optional; 030 private String version; 031 032 public Builder withName(String name) { 033 this.name = name; 034 return this; 035 } 036 037 public Builder withOptional(boolean optional) { 038 this.optional = optional; 039 return this; 040 } 041 042 public Builder withVersion(String version) { 043 this.version = version; 044 return this; 045 } 046 047 @Override 048 public JenkinsPluginDependency build() { 049 return validate(new JenkinsPluginDependency(this)); 050 } 051 } 052 053 public String getName() { 054 return name; 055 } 056 057 public boolean isOptional() { 058 return optional; 059 } 060 061 public String getVersion() { 062 return version; 063 } 064 065}