annotations.io.alauda.kubernetes.api.model.ServiceStatusFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
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 java.lang.Integer;
import javax.validation.Valid;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
public class ServiceStatusFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements ServiceStatusFluent{
private List conditions = new ArrayList();
private HostPortStatusBuilder http;
private String lastUpdated;
private String message;
private String phase;
private String reason;
public ServiceStatusFluentImpl(){
}
public ServiceStatusFluentImpl(ServiceStatus instance){
this.withConditions(instance.getConditions());
this.withHttp(instance.getHttp());
this.withLastUpdated(instance.getLastUpdated());
this.withMessage(instance.getMessage());
this.withPhase(instance.getPhase());
this.withReason(instance.getReason());
}
public A addToConditions(int index,BindingCondition item){
BindingConditionBuilder builder = new BindingConditionBuilder(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,BindingCondition item){
BindingConditionBuilder builder = new BindingConditionBuilder(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(BindingCondition... items){
for (BindingCondition item : items) {BindingConditionBuilder builder = new BindingConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
}
public A addAllToConditions(Collection items){
for (BindingCondition item : items) {BindingConditionBuilder builder = new BindingConditionBuilder(item);_visitables.add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(BindingCondition... items){
for (BindingCondition item : items) {BindingConditionBuilder builder = new BindingConditionBuilder(item);_visitables.remove(builder);this.conditions.remove(builder);} return (A)this;
}
public A removeAllFromConditions(Collection items){
for (BindingCondition item : items) {BindingConditionBuilder builder = new BindingConditionBuilder(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 BindingCondition buildCondition(int index){
return this.conditions.get(index).build();
}
public BindingCondition buildFirstCondition(){
return this.conditions.get(0).build();
}
public BindingCondition buildLastCondition(){
return this.conditions.get(conditions.size() - 1).build();
}
public BindingCondition buildMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
for (BindingConditionBuilder 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 (BindingCondition item : conditions){this.addToConditions(item);}} return (A) this;
}
public A withConditions(BindingCondition... conditions){
this.conditions.clear(); if (conditions != null) {for (BindingCondition item :conditions){ this.addToConditions(item);}} return (A) this;
}
public Boolean hasConditions(){
return conditions!= null && !conditions.isEmpty();
}
public ServiceStatusFluent.ConditionsNested addNewCondition(){
return new ConditionsNestedImpl();
}
public ServiceStatusFluent.ConditionsNested addNewConditionLike(BindingCondition item){
return new ConditionsNestedImpl(-1, item);
}
public ServiceStatusFluent.ConditionsNested setNewConditionLike(int index,BindingCondition item){
return new ConditionsNestedImpl(index, item);
}
public ServiceStatusFluent.ConditionsNested editCondition(int index){
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public ServiceStatusFluent.ConditionsNested editFirstCondition(){
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public ServiceStatusFluent.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 ServiceStatusFluent.ConditionsNested editMatchingCondition(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewHttp(){
return new HttpNestedImpl();
}
public ServiceStatusFluent.HttpNested withNewHttpLike(HostPortStatus item){
return new HttpNestedImpl(item);
}
public ServiceStatusFluent.HttpNested editHttp(){
return withNewHttpLike(getHttp());
}
public ServiceStatusFluent.HttpNested editOrNewHttp(){
return withNewHttpLike(getHttp() != null ? getHttp(): new HostPortStatusBuilder().build());
}
public ServiceStatusFluent.HttpNested editOrNewHttpLike(HostPortStatus item){
return withNewHttpLike(getHttp() != null ? getHttp(): item);
}
public A withNewHttp(Long delay,String lastAttempt,String response,Integer statusCode,String version){
return (A)withHttp(new HostPortStatus(delay, lastAttempt, response, statusCode, version));
}
public String getLastUpdated(){
return this.lastUpdated;
}
public A withLastUpdated(String lastUpdated){
this.lastUpdated=lastUpdated; return (A) this;
}
public Boolean hasLastUpdated(){
return this.lastUpdated!=null;
}
public String getMessage(){
return this.message;
}
public A withMessage(String message){
this.message=message; return (A) this;
}
public Boolean hasMessage(){
return this.message!=null;
}
public String getPhase(){
return this.phase;
}
public A withPhase(String phase){
this.phase=phase; return (A) this;
}
public Boolean hasPhase(){
return this.phase!=null;
}
public String getReason(){
return this.reason;
}
public A withReason(String reason){
this.reason=reason; return (A) this;
}
public Boolean hasReason(){
return this.reason!=null;
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ServiceStatusFluentImpl that = (ServiceStatusFluentImpl) o;
if (conditions != null ? !conditions.equals(that.conditions) :that.conditions != null) return false;
if (http != null ? !http.equals(that.http) :that.http != null) return false;
if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated) :that.lastUpdated != null) return false;
if (message != null ? !message.equals(that.message) :that.message != null) return false;
if (phase != null ? !phase.equals(that.phase) :that.phase != null) return false;
if (reason != null ? !reason.equals(that.reason) :that.reason != null) return false;
return true;
}
public class ConditionsNestedImpl extends BindingConditionFluentImpl> implements ServiceStatusFluent.ConditionsNested,io.alauda.kubernetes.api.builder.Nested{
private final BindingConditionBuilder builder;
private final int index;
ConditionsNestedImpl(int index,BindingCondition item){
this.index = index;
this.builder = new BindingConditionBuilder(this, item);
}
ConditionsNestedImpl(){
this.index = -1;
this.builder = new BindingConditionBuilder(this);
}
public N and(){
return (N) ServiceStatusFluentImpl.this.setToConditions(index, builder.build());
}
public N endCondition(){
return and();
}
}
public class HttpNestedImpl extends HostPortStatusFluentImpl> implements ServiceStatusFluent.HttpNested,io.alauda.kubernetes.api.builder.Nested{
private final HostPortStatusBuilder builder;
HttpNestedImpl(HostPortStatus item){
this.builder = new HostPortStatusBuilder(this, item);
}
HttpNestedImpl(){
this.builder = new HostPortStatusBuilder(this);
}
public N and(){
return (N) ServiceStatusFluentImpl.this.withHttp(builder.build());
}
public N endHttp(){
return and();
}
}
}