io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.APIRequestCountStatusFluent Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.miscellaneous.apiserver.v1;
import io.fabric8.kubernetes.api.model.Condition;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Long;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class APIRequestCountStatusFluent> extends BaseFluent{
public APIRequestCountStatusFluent() {
}
public APIRequestCountStatusFluent(APIRequestCountStatus instance) {
this.copyInstance(instance);
}
private List conditions = new ArrayList();
private PerResourceAPIRequestLogBuilder currentHour;
private ArrayList last24h = new ArrayList();
private String removedInRelease;
private Long requestCount;
private Map additionalProperties;
protected void copyInstance(APIRequestCountStatus instance) {
instance = (instance != null ? instance : new APIRequestCountStatus());
if (instance != null) {
this.withConditions(instance.getConditions());
this.withCurrentHour(instance.getCurrentHour());
this.withLast24h(instance.getLast24h());
this.withRemovedInRelease(instance.getRemovedInRelease());
this.withRequestCount(instance.getRequestCount());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToConditions(int index,Condition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
this.conditions.add(index, item);
return (A)this;
}
public A setToConditions(int index,Condition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
this.conditions.set(index, item); return (A)this;
}
public A addToConditions(io.fabric8.kubernetes.api.model.Condition... items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (Condition item : items) {this.conditions.add(item);} return (A)this;
}
public A addAllToConditions(Collection items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (Condition item : items) {this.conditions.add(item);} return (A)this;
}
public A removeFromConditions(io.fabric8.kubernetes.api.model.Condition... items) {
if (this.conditions == null) return (A)this;
for (Condition item : items) { this.conditions.remove(item);} return (A)this;
}
public A removeAllFromConditions(Collection items) {
if (this.conditions == null) return (A)this;
for (Condition item : items) { this.conditions.remove(item);} return (A)this;
}
public List getConditions() {
return this.conditions;
}
public Condition getCondition(int index) {
return this.conditions.get(index);
}
public Condition getFirstCondition() {
return this.conditions.get(0);
}
public Condition getLastCondition() {
return this.conditions.get(conditions.size() - 1);
}
public Condition getMatchingCondition(Predicate predicate) {
for (Condition item : conditions) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingCondition(Predicate predicate) {
for (Condition item : conditions) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withConditions(List conditions) {
if (conditions != null) {
this.conditions = new ArrayList();
for (Condition item : conditions) {
this.addToConditions(item);
}
} else {
this.conditions = null;
}
return (A) this;
}
public A withConditions(io.fabric8.kubernetes.api.model.Condition... conditions) {
if (this.conditions != null) {
this.conditions.clear();
_visitables.remove("conditions");
}
if (conditions != null) {
for (Condition item : conditions) {
this.addToConditions(item);
}
}
return (A) this;
}
public boolean hasConditions() {
return this.conditions != null && !this.conditions.isEmpty();
}
public PerResourceAPIRequestLog buildCurrentHour() {
return this.currentHour != null ? this.currentHour.build() : null;
}
public A withCurrentHour(PerResourceAPIRequestLog currentHour) {
this._visitables.remove("currentHour");
if (currentHour != null) {
this.currentHour = new PerResourceAPIRequestLogBuilder(currentHour);
this._visitables.get("currentHour").add(this.currentHour);
} else {
this.currentHour = null;
this._visitables.get("currentHour").remove(this.currentHour);
}
return (A) this;
}
public boolean hasCurrentHour() {
return this.currentHour != null;
}
public CurrentHourNested withNewCurrentHour() {
return new CurrentHourNested(null);
}
public CurrentHourNested withNewCurrentHourLike(PerResourceAPIRequestLog item) {
return new CurrentHourNested(item);
}
public CurrentHourNested editCurrentHour() {
return withNewCurrentHourLike(java.util.Optional.ofNullable(buildCurrentHour()).orElse(null));
}
public CurrentHourNested editOrNewCurrentHour() {
return withNewCurrentHourLike(java.util.Optional.ofNullable(buildCurrentHour()).orElse(new PerResourceAPIRequestLogBuilder().build()));
}
public CurrentHourNested editOrNewCurrentHourLike(PerResourceAPIRequestLog item) {
return withNewCurrentHourLike(java.util.Optional.ofNullable(buildCurrentHour()).orElse(item));
}
public A addToLast24h(int index,PerResourceAPIRequestLog item) {
if (this.last24h == null) {this.last24h = new ArrayList();}
PerResourceAPIRequestLogBuilder builder = new PerResourceAPIRequestLogBuilder(item);
if (index < 0 || index >= last24h.size()) { _visitables.get("last24h").add(builder); last24h.add(builder); } else { _visitables.get("last24h").add(index, builder); last24h.add(index, builder);}
return (A)this;
}
public A setToLast24h(int index,PerResourceAPIRequestLog item) {
if (this.last24h == null) {this.last24h = new ArrayList();}
PerResourceAPIRequestLogBuilder builder = new PerResourceAPIRequestLogBuilder(item);
if (index < 0 || index >= last24h.size()) { _visitables.get("last24h").add(builder); last24h.add(builder); } else { _visitables.get("last24h").set(index, builder); last24h.set(index, builder);}
return (A)this;
}
public A addToLast24h(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerResourceAPIRequestLog... items) {
if (this.last24h == null) {this.last24h = new ArrayList();}
for (PerResourceAPIRequestLog item : items) {PerResourceAPIRequestLogBuilder builder = new PerResourceAPIRequestLogBuilder(item);_visitables.get("last24h").add(builder);this.last24h.add(builder);} return (A)this;
}
public A addAllToLast24h(Collection items) {
if (this.last24h == null) {this.last24h = new ArrayList();}
for (PerResourceAPIRequestLog item : items) {PerResourceAPIRequestLogBuilder builder = new PerResourceAPIRequestLogBuilder(item);_visitables.get("last24h").add(builder);this.last24h.add(builder);} return (A)this;
}
public A removeFromLast24h(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerResourceAPIRequestLog... items) {
if (this.last24h == null) return (A)this;
for (PerResourceAPIRequestLog item : items) {PerResourceAPIRequestLogBuilder builder = new PerResourceAPIRequestLogBuilder(item);_visitables.get("last24h").remove(builder); this.last24h.remove(builder);} return (A)this;
}
public A removeAllFromLast24h(Collection items) {
if (this.last24h == null) return (A)this;
for (PerResourceAPIRequestLog item : items) {PerResourceAPIRequestLogBuilder builder = new PerResourceAPIRequestLogBuilder(item);_visitables.get("last24h").remove(builder); this.last24h.remove(builder);} return (A)this;
}
public A removeMatchingFromLast24h(Predicate predicate) {
if (last24h == null) return (A) this;
final Iterator each = last24h.iterator();
final List visitables = _visitables.get("last24h");
while (each.hasNext()) {
PerResourceAPIRequestLogBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildLast24h() {
return this.last24h != null ? build(last24h) : null;
}
public PerResourceAPIRequestLog buildLast24h(int index) {
return this.last24h.get(index).build();
}
public PerResourceAPIRequestLog buildFirstLast24h() {
return this.last24h.get(0).build();
}
public PerResourceAPIRequestLog buildLastLast24h() {
return this.last24h.get(last24h.size() - 1).build();
}
public PerResourceAPIRequestLog buildMatchingLast24h(Predicate predicate) {
for (PerResourceAPIRequestLogBuilder item : last24h) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingLast24h(Predicate predicate) {
for (PerResourceAPIRequestLogBuilder item : last24h) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withLast24h(List last24h) {
if (this.last24h != null) {
this._visitables.get("last24h").clear();
}
if (last24h != null) {
this.last24h = new ArrayList();
for (PerResourceAPIRequestLog item : last24h) {
this.addToLast24h(item);
}
} else {
this.last24h = null;
}
return (A) this;
}
public A withLast24h(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerResourceAPIRequestLog... last24h) {
if (this.last24h != null) {
this.last24h.clear();
_visitables.remove("last24h");
}
if (last24h != null) {
for (PerResourceAPIRequestLog item : last24h) {
this.addToLast24h(item);
}
}
return (A) this;
}
public boolean hasLast24h() {
return this.last24h != null && !this.last24h.isEmpty();
}
public Last24hNested addNewLast24h() {
return new Last24hNested(-1, null);
}
public Last24hNested addNewLast24hLike(PerResourceAPIRequestLog item) {
return new Last24hNested(-1, item);
}
public Last24hNested setNewLast24hLike(int index,PerResourceAPIRequestLog item) {
return new Last24hNested(index, item);
}
public Last24hNested editLast24h(int index) {
if (last24h.size() <= index) throw new RuntimeException("Can't edit last24h. Index exceeds size.");
return setNewLast24hLike(index, buildLast24h(index));
}
public Last24hNested editFirstLast24h() {
if (last24h.size() == 0) throw new RuntimeException("Can't edit first last24h. The list is empty.");
return setNewLast24hLike(0, buildLast24h(0));
}
public Last24hNested editLastLast24h() {
int index = last24h.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last last24h. The list is empty.");
return setNewLast24hLike(index, buildLast24h(index));
}
public Last24hNested editMatchingLast24h(Predicate predicate) {
int index = -1;
for (int i=0;i map) {
if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
}
public A removeFromAdditionalProperties(String key) {
if(this.additionalProperties == null) { return (A) this; }
if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
}
public A removeFromAdditionalProperties(Map map) {
if(this.additionalProperties == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
}
public Map getAdditionalProperties() {
return this.additionalProperties;
}
public A withAdditionalProperties(Map additionalProperties) {
if (additionalProperties == null) {
this.additionalProperties = null;
} else {
this.additionalProperties = new LinkedHashMap(additionalProperties);
}
return (A) this;
}
public boolean hasAdditionalProperties() {
return this.additionalProperties != 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;
APIRequestCountStatusFluent that = (APIRequestCountStatusFluent) o;
if (!java.util.Objects.equals(conditions, that.conditions)) return false;
if (!java.util.Objects.equals(currentHour, that.currentHour)) return false;
if (!java.util.Objects.equals(last24h, that.last24h)) return false;
if (!java.util.Objects.equals(removedInRelease, that.removedInRelease)) return false;
if (!java.util.Objects.equals(requestCount, that.requestCount)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(conditions, currentHour, last24h, removedInRelease, requestCount, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (conditions != null && !conditions.isEmpty()) { sb.append("conditions:"); sb.append(conditions + ","); }
if (currentHour != null) { sb.append("currentHour:"); sb.append(currentHour + ","); }
if (last24h != null && !last24h.isEmpty()) { sb.append("last24h:"); sb.append(last24h + ","); }
if (removedInRelease != null) { sb.append("removedInRelease:"); sb.append(removedInRelease + ","); }
if (requestCount != null) { sb.append("requestCount:"); sb.append(requestCount + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class CurrentHourNested extends PerResourceAPIRequestLogFluent> implements Nested{
CurrentHourNested(PerResourceAPIRequestLog item) {
this.builder = new PerResourceAPIRequestLogBuilder(this, item);
}
PerResourceAPIRequestLogBuilder builder;
public N and() {
return (N) APIRequestCountStatusFluent.this.withCurrentHour(builder.build());
}
public N endCurrentHour() {
return and();
}
}
public class Last24hNested extends PerResourceAPIRequestLogFluent> implements Nested{
Last24hNested(int index,PerResourceAPIRequestLog item) {
this.index = index;
this.builder = new PerResourceAPIRequestLogBuilder(this, item);
}
PerResourceAPIRequestLogBuilder builder;
int index;
public N and() {
return (N) APIRequestCountStatusFluent.this.setToLast24h(index,builder.build());
}
public N endLast24h() {
return and();
}
}
}