io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerResourceAPIRequestLogFluentImpl Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.miscellaneous.apiserver.v1;
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 java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class PerResourceAPIRequestLogFluentImpl> extends BaseFluent implements PerResourceAPIRequestLogFluent{
public PerResourceAPIRequestLogFluentImpl() {
}
public PerResourceAPIRequestLogFluentImpl(PerResourceAPIRequestLog instance) {
this.withByNode(instance.getByNode());
this.withRequestCount(instance.getRequestCount());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
private ArrayList byNode = new ArrayList();
private Long requestCount;
private Map additionalProperties;
public A addToByNode(Integer index,PerNodeAPIRequestLog item) {
if (this.byNode == null) {this.byNode = new ArrayList();}
PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").add(index >= 0 ? index : _visitables.get("byNode").size(), builder);this.byNode.add(index >= 0 ? index : byNode.size(), builder); return (A)this;
}
public A setToByNode(Integer index,PerNodeAPIRequestLog item) {
if (this.byNode == null) {this.byNode = new ArrayList();}
PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);
if (index < 0 || index >= _visitables.get("byNode").size()) { _visitables.get("byNode").add(builder); } else { _visitables.get("byNode").set(index, builder);}
if (index < 0 || index >= byNode.size()) { byNode.add(builder); } else { byNode.set(index, builder);}
return (A)this;
}
public A addToByNode(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerNodeAPIRequestLog... items) {
if (this.byNode == null) {this.byNode = new ArrayList();}
for (PerNodeAPIRequestLog item : items) {PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").add(builder);this.byNode.add(builder);} return (A)this;
}
public A addAllToByNode(Collection items) {
if (this.byNode == null) {this.byNode = new ArrayList();}
for (PerNodeAPIRequestLog item : items) {PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").add(builder);this.byNode.add(builder);} return (A)this;
}
public A removeFromByNode(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerNodeAPIRequestLog... items) {
for (PerNodeAPIRequestLog item : items) {PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").remove(builder);if (this.byNode != null) {this.byNode.remove(builder);}} return (A)this;
}
public A removeAllFromByNode(Collection items) {
for (PerNodeAPIRequestLog item : items) {PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").remove(builder);if (this.byNode != null) {this.byNode.remove(builder);}} return (A)this;
}
public A removeMatchingFromByNode(Predicate predicate) {
if (byNode == null) return (A) this;
final Iterator each = byNode.iterator();
final List visitables = _visitables.get("byNode");
while (each.hasNext()) {
PerNodeAPIRequestLogBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildByNode instead.
* @return The buildable object.
*/
@Deprecated
public List getByNode() {
return byNode != null ? build(byNode) : null;
}
public List buildByNode() {
return byNode != null ? build(byNode) : null;
}
public PerNodeAPIRequestLog buildByNode(Integer index) {
return this.byNode.get(index).build();
}
public PerNodeAPIRequestLog buildFirstByNode() {
return this.byNode.get(0).build();
}
public PerNodeAPIRequestLog buildLastByNode() {
return this.byNode.get(byNode.size() - 1).build();
}
public PerNodeAPIRequestLog buildMatchingByNode(Predicate predicate) {
for (PerNodeAPIRequestLogBuilder item: byNode) { if(predicate.test(item)){ return item.build();} } return null;
}
public Boolean hasMatchingByNode(Predicate predicate) {
for (PerNodeAPIRequestLogBuilder item: byNode) { if(predicate.test(item)){ return true;} } return false;
}
public A withByNode(List byNode) {
if (this.byNode != null) { _visitables.get("byNode").removeAll(this.byNode);}
if (byNode != null) {this.byNode = new ArrayList(); for (PerNodeAPIRequestLog item : byNode){this.addToByNode(item);}} else { this.byNode = null;} return (A) this;
}
public A withByNode(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerNodeAPIRequestLog... byNode) {
if (this.byNode != null) {this.byNode.clear();}
if (byNode != null) {for (PerNodeAPIRequestLog item :byNode){ this.addToByNode(item);}} return (A) this;
}
public Boolean hasByNode() {
return byNode != null && !byNode.isEmpty();
}
public PerResourceAPIRequestLogFluent.ByNodeNested addNewByNode() {
return new PerResourceAPIRequestLogFluentImpl.ByNodeNestedImpl();
}
public PerResourceAPIRequestLogFluent.ByNodeNested addNewByNodeLike(PerNodeAPIRequestLog item) {
return new PerResourceAPIRequestLogFluentImpl.ByNodeNestedImpl(-1, item);
}
public PerResourceAPIRequestLogFluent.ByNodeNested setNewByNodeLike(Integer index,PerNodeAPIRequestLog item) {
return new PerResourceAPIRequestLogFluentImpl.ByNodeNestedImpl(index, item);
}
public PerResourceAPIRequestLogFluent.ByNodeNested editByNode(Integer index) {
if (byNode.size() <= index) throw new RuntimeException("Can't edit byNode. Index exceeds size.");
return setNewByNodeLike(index, buildByNode(index));
}
public PerResourceAPIRequestLogFluent.ByNodeNested editFirstByNode() {
if (byNode.size() == 0) throw new RuntimeException("Can't edit first byNode. The list is empty.");
return setNewByNodeLike(0, buildByNode(0));
}
public PerResourceAPIRequestLogFluent.ByNodeNested editLastByNode() {
int index = byNode.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last byNode. The list is empty.");
return setNewByNodeLike(index, buildByNode(index));
}
public PerResourceAPIRequestLogFluent.ByNodeNested editMatchingByNode(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;
PerResourceAPIRequestLogFluentImpl that = (PerResourceAPIRequestLogFluentImpl) o;
if (byNode != null ? !byNode.equals(that.byNode) :that.byNode != null) return false;
if (requestCount != null ? !requestCount.equals(that.requestCount) :that.requestCount != null) return false;
if (additionalProperties != null ? !additionalProperties.equals(that.additionalProperties) :that.additionalProperties != null) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(byNode, requestCount, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (byNode != null && !byNode.isEmpty()) { sb.append("byNode:"); sb.append(byNode + ","); }
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();
}
class ByNodeNestedImpl extends PerNodeAPIRequestLogFluentImpl> implements PerResourceAPIRequestLogFluent.ByNodeNested,Nested{
ByNodeNestedImpl(Integer index,PerNodeAPIRequestLog item) {
this.index = index;
this.builder = new PerNodeAPIRequestLogBuilder(this, item);
}
ByNodeNestedImpl() {
this.index = -1;
this.builder = new PerNodeAPIRequestLogBuilder(this);
}
PerNodeAPIRequestLogBuilder builder;
Integer index;
public N and() {
return (N) PerResourceAPIRequestLogFluentImpl.this.setToByNode(index,builder.build());
}
public N endByNode() {
return and();
}
}
}