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

io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerNodeAPIRequestLogFluentImpl 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 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 PerNodeAPIRequestLogFluentImpl> extends BaseFluent implements PerNodeAPIRequestLogFluent{
  public PerNodeAPIRequestLogFluentImpl() {
  }
  public PerNodeAPIRequestLogFluentImpl(PerNodeAPIRequestLog instance) {
    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(Integer index,PerUserAPIRequestCount item) {
    if (this.byUser == null) {this.byUser = new ArrayList();}
    PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);_visitables.get("byUser").add(index >= 0 ? index : _visitables.get("byUser").size(), builder);this.byUser.add(index >= 0 ? index : byUser.size(), builder); return (A)this;
  }
  public A setToByUser(Integer index,PerUserAPIRequestCount item) {
    if (this.byUser == null) {this.byUser = new ArrayList();}
    PerUserAPIRequestCountBuilder builder = new PerUserAPIRequestCountBuilder(item);
    if (index < 0 || index >= _visitables.get("byUser").size()) { _visitables.get("byUser").add(builder); } else { _visitables.get("byUser").set(index, builder);}
    if (index < 0 || index >= byUser.size()) { byUser.add(builder); } else { 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(Integer 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").removeAll(this.byUser);}
    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();}
    if (byUser != null) {for (PerUserAPIRequestCount item :byUser){ this.addToByUser(item);}} return (A) this;
  }
  public Boolean hasByUser() {
    return byUser != null && !byUser.isEmpty();
  }
  public PerNodeAPIRequestLogFluent.ByUserNested addNewByUser() {
    return new PerNodeAPIRequestLogFluentImpl.ByUserNestedImpl();
  }
  public PerNodeAPIRequestLogFluent.ByUserNested addNewByUserLike(PerUserAPIRequestCount item) {
    return new PerNodeAPIRequestLogFluentImpl.ByUserNestedImpl(-1, item);
  }
  public PerNodeAPIRequestLogFluent.ByUserNested setNewByUserLike(Integer index,PerUserAPIRequestCount item) {
    return new PerNodeAPIRequestLogFluentImpl.ByUserNestedImpl(index, item);
  }
  public PerNodeAPIRequestLogFluent.ByUserNested editByUser(Integer index) {
    if (byUser.size() <= index) throw new RuntimeException("Can't edit byUser. Index exceeds size.");
    return setNewByUserLike(index, buildByUser(index));
  }
  public PerNodeAPIRequestLogFluent.ByUserNested editFirstByUser() {
    if (byUser.size() == 0) throw new RuntimeException("Can't edit first byUser. The list is empty.");
    return setNewByUserLike(0, buildByUser(0));
  }
  public PerNodeAPIRequestLogFluent.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 PerNodeAPIRequestLogFluent.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;
    PerNodeAPIRequestLogFluentImpl that = (PerNodeAPIRequestLogFluentImpl) o;
    if (byUser != null ? !byUser.equals(that.byUser) :that.byUser != null) return false;
    if (nodeName != null ? !nodeName.equals(that.nodeName) :that.nodeName != 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(byUser,  nodeName,  requestCount,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (byUser != null && !byUser.isEmpty()) { 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 PerNodeAPIRequestLogFluent.ByUserNested,Nested{
    ByUserNestedImpl(Integer index,PerUserAPIRequestCount item) {
      this.index = index;
      this.builder = new PerUserAPIRequestCountBuilder(this, item);
    }
    ByUserNestedImpl() {
      this.index = -1;
      this.builder = new PerUserAPIRequestCountBuilder(this);
    }
    PerUserAPIRequestCountBuilder builder;
    Integer index;
    public N and() {
      return (N) PerNodeAPIRequestLogFluentImpl.this.setToByUser(index,builder.build());
    }
    public N endByUser() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy