com.atlassian.bamboo.specs.api.model.owner.PlanOwnerProperties Maven / Gradle / Ivy
package com.atlassian.bamboo.specs.api.model.owner;
import com.atlassian.bamboo.specs.api.builders.owner.PlanOwner;
import com.atlassian.bamboo.specs.api.codegen.annotations.Builder;
import com.atlassian.bamboo.specs.api.codegen.annotations.CodeGenerator;
import com.atlassian.bamboo.specs.api.model.AtlassianModuleProperties;
import com.atlassian.bamboo.specs.api.model.plan.configuration.PluginConfigurationProperties;
import com.atlassian.bamboo.specs.codegen.emitters.owner.PlanOwnerEmitter;
import java.util.Objects;
@Builder(PlanOwner.class)
@CodeGenerator(PlanOwnerEmitter.class)
public class PlanOwnerProperties implements PluginConfigurationProperties {
private String owner;
private PlanOwnerProperties() {
}
public PlanOwnerProperties(String owner) {
this.owner = owner;
}
public String getOwner() {
return owner;
}
@Override
public AtlassianModuleProperties getAtlassianPlugin() {
return new AtlassianModuleProperties("com.atlassian.buildeng.bamboo-plan-ownership:ownership");
}
@Override
public void validate() {
if (owner == null) {
throw new IllegalStateException("Owner cannot be null");
}
if ("".equals(owner.trim())) {
throw new IllegalStateException("Owner cannot be empty");
}
}
@Override
public int hashCode() {
int hash = 7;
hash = 79 * hash + Objects.hashCode(this.owner);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final PlanOwnerProperties other = (PlanOwnerProperties) obj;
if (!Objects.equals(this.owner, other.owner)) {
return false;
}
return true;
}
}