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

io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerResourceAPIRequestLogFluent Maven / Gradle / Ivy

There is a newer version: 6.13.4
Show newest version
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 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 PerResourceAPIRequestLogFluent> extends BaseFluent{
  public PerResourceAPIRequestLogFluent() {
  }
  
  public PerResourceAPIRequestLogFluent(PerResourceAPIRequestLog instance) {
    this.copyInstance(instance);
  }
  private ArrayList byNode = new ArrayList();
  private Long requestCount;
  private Map additionalProperties;
  
  protected void copyInstance(PerResourceAPIRequestLog instance) {
    instance = (instance != null ? instance : new PerResourceAPIRequestLog());
    if (instance != null) {
          this.withByNode(instance.getByNode());
          this.withRequestCount(instance.getRequestCount());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  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) {
    if (this.byNode == null) return (A)this;
    for (PerNodeAPIRequestLog item : items) {PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").remove(builder); this.byNode.remove(builder);} return (A)this;
  }
  
  public A removeAllFromByNode(Collection items) {
    if (this.byNode == null) return (A)this;
    for (PerNodeAPIRequestLog item : items) {PerNodeAPIRequestLogBuilder builder = new PerNodeAPIRequestLogBuilder(item);_visitables.get("byNode").remove(builder); 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;
  }
  
  public List buildByNode() {
    return this.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) {
      this._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 this.byNode != null && !this.byNode.isEmpty();
  }
  
  public ByNodeNested addNewByNode() {
    return new ByNodeNested(-1, null);
  }
  
  public ByNodeNested addNewByNodeLike(PerNodeAPIRequestLog item) {
    return new ByNodeNested(-1, item);
  }
  
  public ByNodeNested setNewByNodeLike(int index,PerNodeAPIRequestLog item) {
    return new ByNodeNested(index, item);
  }
  
  public ByNodeNested editByNode(int index) {
    if (byNode.size() <= index) throw new RuntimeException("Can't edit byNode. Index exceeds size.");
    return setNewByNodeLike(index, buildByNode(index));
  }
  
  public ByNodeNested editFirstByNode() {
    if (byNode.size() == 0) throw new RuntimeException("Can't edit first byNode. The list is empty.");
    return setNewByNodeLike(0, buildByNode(0));
  }
  
  public 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 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;
    PerResourceAPIRequestLogFluent that = (PerResourceAPIRequestLogFluent) 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 && !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();
  }
  public class ByNodeNested extends PerNodeAPIRequestLogFluent> implements Nested{
    ByNodeNested(int index,PerNodeAPIRequestLog item) {
      this.index = index;
      this.builder = new PerNodeAPIRequestLogBuilder(this, item);
    }
    PerNodeAPIRequestLogBuilder builder;
    int index;
    
    public N and() {
      return (N) PerResourceAPIRequestLogFluent.this.setToByNode(index,builder.build());
    }
    
    public N endByNode() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy