io.alauda.devops.api.model.BuildOutputFluentImpl Maven / Gradle / Ivy
package io.alauda.devops.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import io.alauda.kubernetes.api.model.ObjectReference;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import io.alauda.kubernetes.api.model.LocalObjectReferenceFluentImpl;
import java.util.List;
import java.lang.Boolean;
import io.alauda.kubernetes.api.model.ObjectReferenceFluentImpl;
import io.alauda.kubernetes.api.model.LocalObjectReferenceBuilder;
import javax.validation.Valid;
import io.alauda.kubernetes.api.model.ObjectReferenceBuilder;
import io.alauda.kubernetes.api.model.LocalObjectReference;
import java.util.Collection;
import java.lang.Object;
public class BuildOutputFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements BuildOutputFluent{
private List imageLabels = new ArrayList();
private LocalObjectReferenceBuilder pushSecret;
private ObjectReferenceBuilder to;
public BuildOutputFluentImpl(){
}
public BuildOutputFluentImpl(BuildOutput instance){
this.withImageLabels(instance.getImageLabels());
this.withPushSecret(instance.getPushSecret());
this.withTo(instance.getTo());
}
public A addToImageLabels(int index,ImageLabel item){
ImageLabelBuilder builder = new ImageLabelBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.imageLabels.add(index >= 0 ? index : imageLabels.size(), builder); return (A)this;
}
public A setToImageLabels(int index,ImageLabel item){
ImageLabelBuilder builder = new ImageLabelBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= imageLabels.size()) { imageLabels.add(builder); } else { imageLabels.set(index, builder);}
return (A)this;
}
public A addToImageLabels(ImageLabel... items){
for (ImageLabel item : items) {ImageLabelBuilder builder = new ImageLabelBuilder(item);_visitables.add(builder);this.imageLabels.add(builder);} return (A)this;
}
public A addAllToImageLabels(Collection items){
for (ImageLabel item : items) {ImageLabelBuilder builder = new ImageLabelBuilder(item);_visitables.add(builder);this.imageLabels.add(builder);} return (A)this;
}
public A removeFromImageLabels(ImageLabel... items){
for (ImageLabel item : items) {ImageLabelBuilder builder = new ImageLabelBuilder(item);_visitables.remove(builder);this.imageLabels.remove(builder);} return (A)this;
}
public A removeAllFromImageLabels(Collection items){
for (ImageLabel item : items) {ImageLabelBuilder builder = new ImageLabelBuilder(item);_visitables.remove(builder);this.imageLabels.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildImageLabels instead.
*/
@Deprecated public List getImageLabels(){
return build(imageLabels);
}
public List buildImageLabels(){
return build(imageLabels);
}
public ImageLabel buildImageLabel(int index){
return this.imageLabels.get(index).build();
}
public ImageLabel buildFirstImageLabel(){
return this.imageLabels.get(0).build();
}
public ImageLabel buildLastImageLabel(){
return this.imageLabels.get(imageLabels.size() - 1).build();
}
public ImageLabel buildMatchingImageLabel(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ImageLabelBuilder item: imageLabels) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withImageLabels(List imageLabels){
_visitables.removeAll(this.imageLabels);
this.imageLabels.clear();
if (imageLabels != null) {for (ImageLabel item : imageLabels){this.addToImageLabels(item);}} return (A) this;
}
public A withImageLabels(ImageLabel... imageLabels){
this.imageLabels.clear(); if (imageLabels != null) {for (ImageLabel item :imageLabels){ this.addToImageLabels(item);}} return (A) this;
}
public Boolean hasImageLabels(){
return imageLabels!= null && !imageLabels.isEmpty();
}
public BuildOutputFluent.ImageLabelsNested addNewImageLabel(){
return new ImageLabelsNestedImpl();
}
public BuildOutputFluent.ImageLabelsNested addNewImageLabelLike(ImageLabel item){
return new ImageLabelsNestedImpl(-1, item);
}
public BuildOutputFluent.ImageLabelsNested setNewImageLabelLike(int index,ImageLabel item){
return new ImageLabelsNestedImpl(index, item);
}
public BuildOutputFluent.ImageLabelsNested editImageLabel(int index){
if (imageLabels.size() <= index) throw new RuntimeException("Can't edit imageLabels. Index exceeds size.");
return setNewImageLabelLike(index, buildImageLabel(index));
}
public BuildOutputFluent.ImageLabelsNested editFirstImageLabel(){
if (imageLabels.size() == 0) throw new RuntimeException("Can't edit first imageLabels. The list is empty.");
return setNewImageLabelLike(0, buildImageLabel(0));
}
public BuildOutputFluent.ImageLabelsNested editLastImageLabel(){
int index = imageLabels.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last imageLabels. The list is empty.");
return setNewImageLabelLike(index, buildImageLabel(index));
}
public BuildOutputFluent.ImageLabelsNested editMatchingImageLabel(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewPushSecret(){
return new PushSecretNestedImpl();
}
public BuildOutputFluent.PushSecretNested withNewPushSecretLike(LocalObjectReference item){
return new PushSecretNestedImpl(item);
}
public BuildOutputFluent.PushSecretNested editPushSecret(){
return withNewPushSecretLike(getPushSecret());
}
public BuildOutputFluent.PushSecretNested editOrNewPushSecret(){
return withNewPushSecretLike(getPushSecret() != null ? getPushSecret(): new LocalObjectReferenceBuilder().build());
}
public BuildOutputFluent.PushSecretNested editOrNewPushSecretLike(LocalObjectReference item){
return withNewPushSecretLike(getPushSecret() != null ? getPushSecret(): item);
}
public A withNewPushSecret(String name){
return (A)withPushSecret(new LocalObjectReference(name));
}
/**
* This method has been deprecated, please use method buildTo instead.
*/
@Deprecated public ObjectReference getTo(){
return this.to!=null?this.to.build():null;
}
public ObjectReference buildTo(){
return this.to!=null?this.to.build():null;
}
public A withTo(ObjectReference to){
_visitables.remove(this.to);
if (to!=null){ this.to= new ObjectReferenceBuilder(to); _visitables.add(this.to);} return (A) this;
}
public Boolean hasTo(){
return this.to!=null;
}
public BuildOutputFluent.ToNested withNewTo(){
return new ToNestedImpl();
}
public BuildOutputFluent.ToNested withNewToLike(ObjectReference item){
return new ToNestedImpl(item);
}
public BuildOutputFluent.ToNested editTo(){
return withNewToLike(getTo());
}
public BuildOutputFluent.ToNested editOrNewTo(){
return withNewToLike(getTo() != null ? getTo(): new ObjectReferenceBuilder().build());
}
public BuildOutputFluent.ToNested editOrNewToLike(ObjectReference item){
return withNewToLike(getTo() != null ? getTo(): item);
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BuildOutputFluentImpl that = (BuildOutputFluentImpl) o;
if (imageLabels != null ? !imageLabels.equals(that.imageLabels) :that.imageLabels != null) return false;
if (pushSecret != null ? !pushSecret.equals(that.pushSecret) :that.pushSecret != null) return false;
if (to != null ? !to.equals(that.to) :that.to != null) return false;
return true;
}
public class ImageLabelsNestedImpl extends ImageLabelFluentImpl> implements BuildOutputFluent.ImageLabelsNested,io.alauda.kubernetes.api.builder.Nested{
private final ImageLabelBuilder builder;
private final int index;
ImageLabelsNestedImpl(int index,ImageLabel item){
this.index = index;
this.builder = new ImageLabelBuilder(this, item);
}
ImageLabelsNestedImpl(){
this.index = -1;
this.builder = new ImageLabelBuilder(this);
}
public N and(){
return (N) BuildOutputFluentImpl.this.setToImageLabels(index, builder.build());
}
public N endImageLabel(){
return and();
}
}
public class PushSecretNestedImpl extends LocalObjectReferenceFluentImpl> implements BuildOutputFluent.PushSecretNested,io.alauda.kubernetes.api.builder.Nested{
private final LocalObjectReferenceBuilder builder;
PushSecretNestedImpl(LocalObjectReference item){
this.builder = new LocalObjectReferenceBuilder(this, item);
}
PushSecretNestedImpl(){
this.builder = new LocalObjectReferenceBuilder(this);
}
public N and(){
return (N) BuildOutputFluentImpl.this.withPushSecret(builder.build());
}
public N endPushSecret(){
return and();
}
}
public class ToNestedImpl extends ObjectReferenceFluentImpl> implements BuildOutputFluent.ToNested,io.alauda.kubernetes.api.builder.Nested{
private final ObjectReferenceBuilder builder;
ToNestedImpl(ObjectReference item){
this.builder = new ObjectReferenceBuilder(this, item);
}
ToNestedImpl(){
this.builder = new ObjectReferenceBuilder(this);
}
public N and(){
return (N) BuildOutputFluentImpl.this.withTo(builder.build());
}
public N endTo(){
return and();
}
}
}