annotations.io.alauda.kubernetes.api.model.PodStatusFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.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 java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
public class PodStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PodStatusFluent{
private List conditions = new ArrayList();
private List containerStatuses = new ArrayList();
private String hostIP;
private List initContainerStatuses = new ArrayList();
private String message;
private String phase;
private String podIP;
private String qosClass;
private String reason;
private String startTime;
public PodStatusFluentImpl(){
}
public PodStatusFluentImpl(PodStatus instance){
this.withConditions(instance.getConditions());
this.withContainerStatuses(instance.getContainerStatuses());
this.withHostIP(instance.getHostIP());
this.withInitContainerStatuses(instance.getInitContainerStatuses());
this.withMessage(instance.getMessage());
this.withPhase(instance.getPhase());
this.withPodIP(instance.getPodIP());
this.withQosClass(instance.getQosClass());
this.withReason(instance.getReason());
this.withStartTime(instance.getStartTime());
}
public A addToConditions(int index,PodCondition item){
PodConditionBuilder builder = new PodConditionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
}
public A setToConditions(int index,PodCondition item){
PodConditionBuilder builder = new PodConditionBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
return (A)this;
}
public A addToConditions(PodCondition... items){
for (PodCondition item : items) {PodConditionBuilder builder = new PodConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
}
public A addAllToConditions(Collection items){
for (PodCondition item : items) {PodConditionBuilder builder = new PodConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(PodCondition... items){
for (PodCondition item : items) {PodConditionBuilder builder = new PodConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
}
public A removeAllFromConditions(Collection items){
for (PodCondition item : items) {PodConditionBuilder builder = new PodConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildConditions instead.
*/
@Deprecated public List getConditions(){
return build(conditions);
}
public List buildConditions(){
return build(conditions);
}
public PodCondition buildCondition(int index){
return this.conditions.get(index).build();
}
public PodCondition buildFirstCondition(){
return this.conditions.get(0).build();
}
public PodCondition buildLastCondition(){
return this.conditions.get(conditions.size() - 1).build();
}
public PodCondition buildMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
for (PodConditionBuilder item: conditions) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withConditions(List conditions){
_visitables.removeAll(this.conditions);
this.conditions.clear();
if (conditions != null) {for (PodCondition item : conditions){this.addToConditions(item);}} return (A) this;
}
public A withConditions(PodCondition... conditions){
this.conditions.clear(); if (conditions != null) {for (PodCondition item :conditions){ this.addToConditions(item);}} return (A) this;
}
public Boolean hasConditions(){
return conditions!= null && !conditions.isEmpty();
}
public PodStatusFluent.ConditionsNested addNewCondition(){
return new ConditionsNestedImpl();
}
public PodStatusFluent.ConditionsNested addNewConditionLike(PodCondition item){
return new ConditionsNestedImpl(-1, item);
}
public PodStatusFluent.ConditionsNested setNewConditionLike(int index,PodCondition item){
return new ConditionsNestedImpl(index, item);
}
public PodStatusFluent.ConditionsNested editCondition(int index){
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public PodStatusFluent.ConditionsNested editFirstCondition(){
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public PodStatusFluent.ConditionsNested editLastCondition(){
int index = conditions.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last conditions. The list is empty.");
return setNewConditionLike(index, buildCondition(index));
}
public PodStatusFluent.ConditionsNested editMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.containerStatuses.add(index >= 0 ? index : containerStatuses.size(), builder); return (A)this;
}
public A setToContainerStatuses(int index,ContainerStatus item){
ContainerStatusBuilder builder = new ContainerStatusBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= containerStatuses.size()) { containerStatuses.add(builder); } else { containerStatuses.set(index, builder);}
return (A)this;
}
public A addToContainerStatuses(ContainerStatus... items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.add(builder);this.containerStatuses.add(builder);} return (A)this;
}
public A addAllToContainerStatuses(Collection items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.add(builder);this.containerStatuses.add(builder);} return (A)this;
}
public A removeFromContainerStatuses(ContainerStatus... items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.remove(builder);this.containerStatuses.remove(builder);} return (A)this;
}
public A removeAllFromContainerStatuses(Collection items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.remove(builder);this.containerStatuses.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildContainerStatuses instead.
*/
@Deprecated public List getContainerStatuses(){
return build(containerStatuses);
}
public List buildContainerStatuses(){
return build(containerStatuses);
}
public ContainerStatus buildContainerStatus(int index){
return this.containerStatuses.get(index).build();
}
public ContainerStatus buildFirstContainerStatus(){
return this.containerStatuses.get(0).build();
}
public ContainerStatus buildLastContainerStatus(){
return this.containerStatuses.get(containerStatuses.size() - 1).build();
}
public ContainerStatus buildMatchingContainerStatus(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ContainerStatusBuilder item: containerStatuses) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withContainerStatuses(List containerStatuses){
_visitables.removeAll(this.containerStatuses);
this.containerStatuses.clear();
if (containerStatuses != null) {for (ContainerStatus item : containerStatuses){this.addToContainerStatuses(item);}} return (A) this;
}
public A withContainerStatuses(ContainerStatus... containerStatuses){
this.containerStatuses.clear(); if (containerStatuses != null) {for (ContainerStatus item :containerStatuses){ this.addToContainerStatuses(item);}} return (A) this;
}
public Boolean hasContainerStatuses(){
return containerStatuses!= null && !containerStatuses.isEmpty();
}
public PodStatusFluent.ContainerStatusesNested addNewContainerStatus(){
return new ContainerStatusesNestedImpl();
}
public PodStatusFluent.ContainerStatusesNested addNewContainerStatusLike(ContainerStatus item){
return new ContainerStatusesNestedImpl(-1, item);
}
public PodStatusFluent.ContainerStatusesNested setNewContainerStatusLike(int index,ContainerStatus item){
return new ContainerStatusesNestedImpl(index, item);
}
public PodStatusFluent.ContainerStatusesNested editContainerStatus(int index){
if (containerStatuses.size() <= index) throw new RuntimeException("Can't edit containerStatuses. Index exceeds size.");
return setNewContainerStatusLike(index, buildContainerStatus(index));
}
public PodStatusFluent.ContainerStatusesNested editFirstContainerStatus(){
if (containerStatuses.size() == 0) throw new RuntimeException("Can't edit first containerStatuses. The list is empty.");
return setNewContainerStatusLike(0, buildContainerStatus(0));
}
public PodStatusFluent.ContainerStatusesNested editLastContainerStatus(){
int index = containerStatuses.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last containerStatuses. The list is empty.");
return setNewContainerStatusLike(index, buildContainerStatus(index));
}
public PodStatusFluent.ContainerStatusesNested editMatchingContainerStatus(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.initContainerStatuses.add(index >= 0 ? index : initContainerStatuses.size(), builder); return (A)this;
}
public A setToInitContainerStatuses(int index,ContainerStatus item){
ContainerStatusBuilder builder = new ContainerStatusBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= initContainerStatuses.size()) { initContainerStatuses.add(builder); } else { initContainerStatuses.set(index, builder);}
return (A)this;
}
public A addToInitContainerStatuses(ContainerStatus... items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.add(builder);this.initContainerStatuses.add(builder);} return (A)this;
}
public A addAllToInitContainerStatuses(Collection items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.add(builder);this.initContainerStatuses.add(builder);} return (A)this;
}
public A removeFromInitContainerStatuses(ContainerStatus... items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.remove(builder);this.initContainerStatuses.remove(builder);} return (A)this;
}
public A removeAllFromInitContainerStatuses(Collection items){
for (ContainerStatus item : items) {ContainerStatusBuilder builder = new ContainerStatusBuilder(item);_visitables.remove(builder);this.initContainerStatuses.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildInitContainerStatuses instead.
*/
@Deprecated public List getInitContainerStatuses(){
return build(initContainerStatuses);
}
public List buildInitContainerStatuses(){
return build(initContainerStatuses);
}
public ContainerStatus buildInitContainerStatus(int index){
return this.initContainerStatuses.get(index).build();
}
public ContainerStatus buildFirstInitContainerStatus(){
return this.initContainerStatuses.get(0).build();
}
public ContainerStatus buildLastInitContainerStatus(){
return this.initContainerStatuses.get(initContainerStatuses.size() - 1).build();
}
public ContainerStatus buildMatchingInitContainerStatus(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ContainerStatusBuilder item: initContainerStatuses) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withInitContainerStatuses(List initContainerStatuses){
_visitables.removeAll(this.initContainerStatuses);
this.initContainerStatuses.clear();
if (initContainerStatuses != null) {for (ContainerStatus item : initContainerStatuses){this.addToInitContainerStatuses(item);}} return (A) this;
}
public A withInitContainerStatuses(ContainerStatus... initContainerStatuses){
this.initContainerStatuses.clear(); if (initContainerStatuses != null) {for (ContainerStatus item :initContainerStatuses){ this.addToInitContainerStatuses(item);}} return (A) this;
}
public Boolean hasInitContainerStatuses(){
return initContainerStatuses!= null && !initContainerStatuses.isEmpty();
}
public PodStatusFluent.InitContainerStatusesNested addNewInitContainerStatus(){
return new InitContainerStatusesNestedImpl();
}
public PodStatusFluent.InitContainerStatusesNested addNewInitContainerStatusLike(ContainerStatus item){
return new InitContainerStatusesNestedImpl(-1, item);
}
public PodStatusFluent.InitContainerStatusesNested setNewInitContainerStatusLike(int index,ContainerStatus item){
return new InitContainerStatusesNestedImpl(index, item);
}
public PodStatusFluent.InitContainerStatusesNested editInitContainerStatus(int index){
if (initContainerStatuses.size() <= index) throw new RuntimeException("Can't edit initContainerStatuses. Index exceeds size.");
return setNewInitContainerStatusLike(index, buildInitContainerStatus(index));
}
public PodStatusFluent.InitContainerStatusesNested editFirstInitContainerStatus(){
if (initContainerStatuses.size() == 0) throw new RuntimeException("Can't edit first initContainerStatuses. The list is empty.");
return setNewInitContainerStatusLike(0, buildInitContainerStatus(0));
}
public PodStatusFluent.InitContainerStatusesNested editLastInitContainerStatus(){
int index = initContainerStatuses.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last initContainerStatuses. The list is empty.");
return setNewInitContainerStatusLike(index, buildInitContainerStatus(index));
}
public PodStatusFluent.InitContainerStatusesNested editMatchingInitContainerStatus(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends PodConditionFluentImpl> implements PodStatusFluent.ConditionsNested,io.alauda.kubernetes.api.builder.Nested{
private final PodConditionBuilder builder;
private final int index;
ConditionsNestedImpl(int index,PodCondition item){
this.index = index;
this.builder = new PodConditionBuilder(this, item);
}
ConditionsNestedImpl(){
this.index = -1;
this.builder = new PodConditionBuilder(this);
}
public N and(){
return (N) PodStatusFluentImpl.this.setToConditions(index, builder.build());
}
public N endCondition(){
return and();
}
}
public class ContainerStatusesNestedImpl extends ContainerStatusFluentImpl> implements PodStatusFluent.ContainerStatusesNested,io.alauda.kubernetes.api.builder.Nested{
private final ContainerStatusBuilder builder;
private final int index;
ContainerStatusesNestedImpl(int index,ContainerStatus item){
this.index = index;
this.builder = new ContainerStatusBuilder(this, item);
}
ContainerStatusesNestedImpl(){
this.index = -1;
this.builder = new ContainerStatusBuilder(this);
}
public N and(){
return (N) PodStatusFluentImpl.this.setToContainerStatuses(index, builder.build());
}
public N endContainerStatus(){
return and();
}
}
public class InitContainerStatusesNestedImpl extends ContainerStatusFluentImpl> implements PodStatusFluent.InitContainerStatusesNested,io.alauda.kubernetes.api.builder.Nested{
private final ContainerStatusBuilder builder;
private final int index;
InitContainerStatusesNestedImpl(int index,ContainerStatus item){
this.index = index;
this.builder = new ContainerStatusBuilder(this, item);
}
InitContainerStatusesNestedImpl(){
this.index = -1;
this.builder = new ContainerStatusBuilder(this);
}
public N and(){
return (N) PodStatusFluentImpl.this.setToInitContainerStatuses(index, builder.build());
}
public N endInitContainerStatus(){
return and();
}
}
}