annotations.me.snowdrop.applicationcrd.api.model.DescriptorBuilder Maven / Gradle / Ivy
package me.snowdrop.applicationcrd.api.model;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;
import javax.validation.Validator;
public class DescriptorBuilder extends DescriptorFluentImpl implements VisitableBuilder{
DescriptorFluent> fluent;
Boolean validationEnabled;
Validator validator;
public DescriptorBuilder(){
this(true);
}
public DescriptorBuilder(Boolean validationEnabled){
this(new Descriptor(), validationEnabled);
}
public DescriptorBuilder(DescriptorFluent> fluent){
this(fluent, true);
}
public DescriptorBuilder(DescriptorFluent> fluent,Boolean validationEnabled){
this(fluent, new Descriptor(), validationEnabled);
}
public DescriptorBuilder(DescriptorFluent> fluent,Descriptor instance){
this(fluent, instance, true);
}
public DescriptorBuilder(DescriptorFluent> fluent,Descriptor instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withDescription(instance.getDescription());
fluent.withIcons(instance.getIcons());
fluent.withKeywords(instance.getKeywords());
fluent.withLinks(instance.getLinks());
fluent.withMaintainers(instance.getMaintainers());
fluent.withNotes(instance.getNotes());
fluent.withOwners(instance.getOwners());
fluent.withType(instance.getType());
fluent.withVersion(instance.getVersion());
this.validationEnabled = validationEnabled;
}
public DescriptorBuilder(Descriptor instance){
this(instance,true);
}
public DescriptorBuilder(Descriptor instance,Boolean validationEnabled){
this.fluent = this;
this.withDescription(instance.getDescription());
this.withIcons(instance.getIcons());
this.withKeywords(instance.getKeywords());
this.withLinks(instance.getLinks());
this.withMaintainers(instance.getMaintainers());
this.withNotes(instance.getNotes());
this.withOwners(instance.getOwners());
this.withType(instance.getType());
this.withVersion(instance.getVersion());
this.validationEnabled = validationEnabled;
}
public DescriptorBuilder(Validator validator){
this(new Descriptor(), true);
}
public DescriptorBuilder(DescriptorFluent> fluent,Descriptor instance,Validator validator){
this.fluent = fluent;
fluent.withDescription(instance.getDescription());
fluent.withIcons(instance.getIcons());
fluent.withKeywords(instance.getKeywords());
fluent.withLinks(instance.getLinks());
fluent.withMaintainers(instance.getMaintainers());
fluent.withNotes(instance.getNotes());
fluent.withOwners(instance.getOwners());
fluent.withType(instance.getType());
fluent.withVersion(instance.getVersion());
this.validator = validator;
this.validationEnabled = validator != null;
}
public DescriptorBuilder(Descriptor instance,Validator validator){
this.fluent = this;
this.withDescription(instance.getDescription());
this.withIcons(instance.getIcons());
this.withKeywords(instance.getKeywords());
this.withLinks(instance.getLinks());
this.withMaintainers(instance.getMaintainers());
this.withNotes(instance.getNotes());
this.withOwners(instance.getOwners());
this.withType(instance.getType());
this.withVersion(instance.getVersion());
this.validator = validator;
this.validationEnabled = validator != null;
}
public Descriptor build(){
Descriptor buildable = new Descriptor(fluent.getDescription(),fluent.getIcons(),fluent.getKeywords(),fluent.getLinks(),fluent.getMaintainers(),fluent.getNotes(),fluent.getOwners(),fluent.getType(),fluent.getVersion());
if (validationEnabled) {io.fabric8.kubernetes.api.builder.ValidationUtils.validate(buildable, validator);}
return buildable;
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
DescriptorBuilder that = (DescriptorBuilder) o;
if (fluent != null &&fluent != this ? !fluent.equals(that.fluent) :that.fluent != null &&fluent != this ) return false;
if (validationEnabled != null ? !validationEnabled.equals(that.validationEnabled) :that.validationEnabled != null) return false;
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy