io.kubernetes.client.openapi.models.V1ServiceStatusFluentImpl Maven / Gradle / Ivy
package io.kubernetes.client.openapi.models;
import io.kubernetes.client.fluent.VisitableBuilder;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import io.kubernetes.client.fluent.Predicate;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.util.Collection;
import java.lang.Object;
public class V1ServiceStatusFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1ServiceStatusFluent {
private List conditions;
private V1LoadBalancerStatusBuilder loadBalancer;
public V1ServiceStatusFluentImpl() {
}
public V1ServiceStatusFluentImpl(V1ServiceStatus instance) {
this.withConditions(instance.getConditions());
this.withLoadBalancer(instance.getLoadBalancer());
}
public A addToConditions(int index,V1Condition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
V1ConditionBuilder builder = new V1ConditionBuilder(item);_visitables.get("conditions").add(index >= 0 ? index : _visitables.get("conditions").size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
}
public A setToConditions(int index,V1Condition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
V1ConditionBuilder builder = new V1ConditionBuilder(item);
if (index < 0 || index >= _visitables.get("conditions").size()) { _visitables.get("conditions").add(builder); } else { _visitables.get("conditions").set(index, builder);}
if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
return (A)this;
}
public A addToConditions(V1Condition... items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (V1Condition item : items) {V1ConditionBuilder builder = new V1ConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A addAllToConditions(Collection items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (V1Condition item : items) {V1ConditionBuilder builder = new V1ConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(V1Condition... items) {
for (V1Condition item : items) {V1ConditionBuilder builder = new V1ConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
}
public A removeAllFromConditions(Collection items) {
for (V1Condition item : items) {V1ConditionBuilder builder = new V1ConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
}
public A removeMatchingFromConditions(io.kubernetes.client.fluent.Predicate predicate) {
if (conditions == null) return (A) this;
final Iterator each = conditions.iterator();
final List visitables = _visitables.get("conditions");
while (each.hasNext()) {
V1ConditionBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildConditions instead.
* @return The buildable object.
*/
@Deprecated public List getConditions() {
return build(conditions);
}
public List buildConditions() {
return build(conditions);
}
public V1Condition buildCondition(int index) {
return this.conditions.get(index).build();
}
public V1Condition buildFirstCondition() {
return this.conditions.get(0).build();
}
public V1Condition buildLastCondition() {
return this.conditions.get(conditions.size() - 1).build();
}
public V1Condition buildMatchingCondition(io.kubernetes.client.fluent.Predicate predicate) {
for (V1ConditionBuilder item: conditions) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingCondition(io.kubernetes.client.fluent.Predicate predicate) {
for (V1ConditionBuilder item: conditions) { if(predicate.apply(item)){ return true;} } return false;
}
public A withConditions(List conditions) {
if (this.conditions != null) { _visitables.get("conditions").removeAll(this.conditions);}
if (conditions != null) {this.conditions = new ArrayList(); for (V1Condition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
}
public A withConditions(V1Condition... conditions) {
if (this.conditions != null) {this.conditions.clear();}
if (conditions != null) {for (V1Condition item :conditions){ this.addToConditions(item);}} return (A) this;
}
public Boolean hasConditions() {
return conditions != null && !conditions.isEmpty();
}
public V1ServiceStatusFluent.ConditionsNested addNewCondition() {
return new ConditionsNestedImpl();
}
public V1ServiceStatusFluent.ConditionsNested addNewConditionLike(V1Condition item) {
return new ConditionsNestedImpl(-1, item);
}
public V1ServiceStatusFluent.ConditionsNested setNewConditionLike(int index,V1Condition item) {
return new ConditionsNestedImpl(index, item);
}
public V1ServiceStatusFluent.ConditionsNested editCondition(int index) {
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public V1ServiceStatusFluent.ConditionsNested editFirstCondition() {
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public V1ServiceStatusFluent.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 V1ServiceStatusFluent.ConditionsNested editMatchingCondition(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i withNewLoadBalancer() {
return new LoadBalancerNestedImpl();
}
public V1ServiceStatusFluent.LoadBalancerNested withNewLoadBalancerLike(V1LoadBalancerStatus item) {
return new LoadBalancerNestedImpl(item);
}
public V1ServiceStatusFluent.LoadBalancerNested editLoadBalancer() {
return withNewLoadBalancerLike(getLoadBalancer());
}
public V1ServiceStatusFluent.LoadBalancerNested editOrNewLoadBalancer() {
return withNewLoadBalancerLike(getLoadBalancer() != null ? getLoadBalancer(): new V1LoadBalancerStatusBuilder().build());
}
public V1ServiceStatusFluent.LoadBalancerNested editOrNewLoadBalancerLike(V1LoadBalancerStatus item) {
return withNewLoadBalancerLike(getLoadBalancer() != null ? getLoadBalancer(): item);
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V1ServiceStatusFluentImpl that = (V1ServiceStatusFluentImpl) o;
if (conditions != null ? !conditions.equals(that.conditions) :that.conditions != null) return false;
if (loadBalancer != null ? !loadBalancer.equals(that.loadBalancer) :that.loadBalancer != null) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(conditions, loadBalancer, super.hashCode());
}
public class ConditionsNestedImpl extends V1ConditionFluentImpl> implements V1ServiceStatusFluent.ConditionsNested,io.kubernetes.client.fluent.Nested {
private final V1ConditionBuilder builder;
private final int index;
ConditionsNestedImpl(int index,V1Condition item) {
this.index = index;
this.builder = new V1ConditionBuilder(this, item);
}
ConditionsNestedImpl() {
this.index = -1;
this.builder = new V1ConditionBuilder(this);
}
public N and() {
return (N) V1ServiceStatusFluentImpl.this.setToConditions(index,builder.build());
}
public N endCondition() {
return and();
}
}
public class LoadBalancerNestedImpl extends V1LoadBalancerStatusFluentImpl> implements V1ServiceStatusFluent.LoadBalancerNested,io.kubernetes.client.fluent.Nested {
private final V1LoadBalancerStatusBuilder builder;
LoadBalancerNestedImpl(V1LoadBalancerStatus item) {
this.builder = new V1LoadBalancerStatusBuilder(this, item);
}
LoadBalancerNestedImpl() {
this.builder = new V1LoadBalancerStatusBuilder(this);
}
public N and() {
return (N) V1ServiceStatusFluentImpl.this.withLoadBalancer(builder.build());
}
public N endLoadBalancer() {
return and();
}
}
}