io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerNodeAPIRequestLogFluentImpl 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.lang.Long;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class PerNodeAPIRequestLogFluentImpl> extends BaseFluent implements PerNodeAPIRequestLogFluent{
public PerNodeAPIRequestLogFluentImpl() {
}
public PerNodeAPIRequestLogFluentImpl(PerNodeAPIRequestLog instance) {
if (instance != null) {
this.withByUser(instance.getByUser());
this.withNodeName(instance.getNodeName());
this.withRequestCount(instance.getRequestCount());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
private ArrayList byUser = new ArrayList();
private String nodeName;
private Long requestCount;
private Map additionalProperties;
public A addToByUser(int index,PerUserAPIRequestCount item) {
if (this.byUser == null) {this.byUser = new ArrayList();}
PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);
if (index < 0 || index >= byUser.size()) { _visitables.get("byUser").add(builder); byUser.add(builder); } else { _visitables.get("byUser").add(index, builder); byUser.add(index, builder);}
return (A)this;
}
public A setToByUser(int index,PerUserAPIRequestCount item) {
if (this.byUser == null) {this.byUser = new ArrayList();}
PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);
if (index < 0 || index >= byUser.size()) { _visitables.get("byUser").add(builder); byUser.add(builder); } else { _visitables.get("byUser").set(index, builder); byUser.set(index, builder);}
return (A)this;
}
public A addToByUser(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerUserAPIRequestCount... items) {
if (this.byUser == null) {this.byUser = new ArrayList();}
for (PerUserAPIRequestCount item : items) {PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);_visitables.get("byUser").add(builder);this.byUser.add(builder);} return (A)this;
}
public A addAllToByUser(Collection items) {
if (this.byUser == null) {this.byUser = new ArrayList();}
for (PerUserAPIRequestCount item : items) {PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);_visitables.get("byUser").add(builder);this.byUser.add(builder);} return (A)this;
}
public A removeFromByUser(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerUserAPIRequestCount... items) {
for (PerUserAPIRequestCount item : items) {PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);_visitables.get("byUser").remove(builder);if (this.byUser != null) {this.byUser.remove(builder);}} return (A)this;
}
public A removeAllFromByUser(Collection items) {
for (PerUserAPIRequestCount item : items) {PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);_visitables.get("byUser").remove(builder);if (this.byUser != null) {this.byUser.remove(builder);}} return (A)this;
}
public A removeMatchingFromByUser(Predicate predicate) {
if (byUser == null) return (A) this;
final Iterator each = byUser.iterator();
final List visitables = _visitables.get("byUser");
while (each.hasNext()) {
PerUserAPIRequestCountBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildByUser instead.
* @return The buildable object.
*/
@Deprecated
public List getByUser() {
return byUser != null ? build(byUser) : null;
}
public List buildByUser() {
return byUser != null ? build(byUser) : null;
}
public PerUserAPIRequestCount buildByUser(int index) {
return this.byUser.get(index).build();
}
public PerUserAPIRequestCount buildFirstByUser() {
return this.byUser.get(0).build();
}
public PerUserAPIRequestCount buildLastByUser() {
return this.byUser.get(byUser.size() - 1).build();
}
public PerUserAPIRequestCount buildMatchingByUser(Predicate predicate) {
for (PerUserAPIRequestCountBuilder item: byUser) { if(predicate.test(item)){ return item.build();} } return null;
}
public Boolean hasMatchingByUser(Predicate predicate) {
for (PerUserAPIRequestCountBuilder item: byUser) { if(predicate.test(item)){ return true;} } return false;
}
public A withByUser(List byUser) {
if (this.byUser != null) { _visitables.get("byUser").clear();}
if (byUser != null) {this.byUser = new ArrayList(); for (PerUserAPIRequestCount item : byUser){this.addToByUser(item);}} else { this.byUser = null;} return (A) this;
}
public A withByUser(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerUserAPIRequestCount... byUser) {
if (this.byUser != null) {this.byUser.clear(); _visitables.remove("byUser"); }
if (byUser != null) {for (PerUserAPIRequestCount item :byUser){ this.addToByUser(item);}} return (A) this;
}
public Boolean hasByUser() {
return byUser != null && !byUser.isEmpty();
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested addNewByUser() {
return new PerNodeAPIRequestLogFluentImpl.ByUserNestedImpl();
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested addNewByUserLike(PerUserAPIRequestCount item) {
return new PerNodeAPIRequestLogFluentImpl.ByUserNestedImpl(-1, item);
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested setNewByUserLike(int index,PerUserAPIRequestCount item) {
return new PerNodeAPIRequestLogFluentImpl.ByUserNestedImpl(index, item);
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested editByUser(int index) {
if (byUser.size() <= index) throw new RuntimeException("Can't edit byUser. Index exceeds size.");
return setNewByUserLike(index, buildByUser(index));
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested editFirstByUser() {
if (byUser.size() == 0) throw new RuntimeException("Can't edit first byUser. The list is empty.");
return setNewByUserLike(0, buildByUser(0));
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested editLastByUser() {
int index = byUser.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last byUser. The list is empty.");
return setNewByUserLike(index, buildByUser(index));
}
public PerNodeAPIRequestLogFluentImpl.ByUserNested editMatchingByUser(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;
PerNodeAPIRequestLogFluentImpl that = (PerNodeAPIRequestLogFluentImpl) o;
if (!java.util.Objects.equals(byUser, that.byUser)) return false;
if (!java.util.Objects.equals(nodeName, that.nodeName)) 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(byUser, nodeName, requestCount, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (byUser != null) { sb.append("byUser:"); sb.append(byUser + ","); }
if (nodeName != null) { sb.append("nodeName:"); sb.append(nodeName + ","); }
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 ByUserNestedImpl extends PerUserAPIRequestCountFluentImpl> implements PerNodeAPIRequestLogFluentImpl.ByUserNested,Nested{
ByUserNestedImpl(int index,PerUserAPIRequestCount item) {
this.index = index;
this.builder = new PerUserAPIRequestCountBuilder(this, item);
}
ByUserNestedImpl() {
this.index = -1;
this.builder = new PerUserAPIRequestCountBuilder(this);
}
PerUserAPIRequestCountBuilder builder;
int index;
public N and() {
return (N) PerNodeAPIRequestLogFluentImpl.this.setToByUser(index,builder.build());
}
public N endByUser() {
return and();
}
}
}