All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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.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 PerResourceAPIRequestLogFluentImpl> extends BaseFluent implements PerResourceAPIRequestLogFluent{
  public PerResourceAPIRequestLogFluentImpl() {
  }
  public PerResourceAPIRequestLogFluentImpl(PerResourceAPIRequestLog instance) {
    if (instance != null) {
      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(int index,PerNodeAPIRequestLog item) {
    if (this.byNode == null) {this.byNode = new ArrayList();}
    PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);
    if (index < 0 || index >= byNode.size()) { _visitables.get("byNode").add(builder); byNode.add(builder); } else { _visitables.get("byNode").add(index, builder); byNode.add(index, builder);}
    return (A)this;
  }
  public A setToByNode(int index,PerNodeAPIRequestLog item) {
    if (this.byNode == null) {this.byNode = new ArrayList();}
    PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);
    if (index < 0 || index >= byNode.size()) { _visitables.get("byNode").add(builder); byNode.add(builder); } else { _visitables.get("byNode").set(index, builder); 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(int 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").clear();}
    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(); _visitables.remove("byNode"); }
    if (byNode != null) {for (PerNodeAPIRequestLog item :byNode){ this.addToByNode(item);}} return (A) this;
  }
  public Boolean hasByNode() {
    return byNode != null && !byNode.isEmpty();
  }
  public PerResourceAPIRequestLogFluentImpl.ByNodeNested addNewByNode() {
    return new PerResourceAPIRequestLogFluentImpl.ByNodeNestedImpl();
  }
  public PerResourceAPIRequestLogFluentImpl.ByNodeNested addNewByNodeLike(PerNodeAPIRequestLog item) {
    return new PerResourceAPIRequestLogFluentImpl.ByNodeNestedImpl(-1, item);
  }
  public PerResourceAPIRequestLogFluentImpl.ByNodeNested setNewByNodeLike(int index,PerNodeAPIRequestLog item) {
    return new PerResourceAPIRequestLogFluentImpl.ByNodeNestedImpl(index, item);
  }
  public PerResourceAPIRequestLogFluentImpl.ByNodeNested editByNode(int index) {
    if (byNode.size() <= index) throw new RuntimeException("Can't edit byNode. Index exceeds size.");
    return setNewByNodeLike(index, buildByNode(index));
  }
  public PerResourceAPIRequestLogFluentImpl.ByNodeNested editFirstByNode() {
    if (byNode.size() == 0) throw new RuntimeException("Can't edit first byNode. The list is empty.");
    return setNewByNodeLike(0, buildByNode(0));
  }
  public PerResourceAPIRequestLogFluentImpl.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 PerResourceAPIRequestLogFluentImpl.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;
    if (!super.equals(o)) return false;
    PerResourceAPIRequestLogFluentImpl that = (PerResourceAPIRequestLogFluentImpl) o;
    if (!java.util.Objects.equals(byNode, that.byNode)) 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(byNode,  requestCount,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (byNode != null) { 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 PerResourceAPIRequestLogFluentImpl.ByNodeNested,Nested{
    ByNodeNestedImpl(int index,PerNodeAPIRequestLog item) {
      this.index = index;
      this.builder = new PerNodeAPIRequestLogBuilder(this, item);
    }
    ByNodeNestedImpl() {
      this.index = -1;
      this.builder = new PerNodeAPIRequestLogBuilder(this);
    }
    PerNodeAPIRequestLogBuilder builder;
    int index;
    public N and() {
      return (N) PerResourceAPIRequestLogFluentImpl.this.setToByNode(index,builder.build());
    }
    public N endByNode() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy