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

io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerUserAPIRequestCountFluentImpl 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 PerUserAPIRequestCountFluentImpl> extends BaseFluent implements PerUserAPIRequestCountFluent{
  public PerUserAPIRequestCountFluentImpl() {
  }
  public PerUserAPIRequestCountFluentImpl(PerUserAPIRequestCount instance) {
    if (instance != null) {
      this.withByVerb(instance.getByVerb());
      this.withRequestCount(instance.getRequestCount());
      this.withUserAgent(instance.getUserAgent());
      this.withUsername(instance.getUsername());
      this.withAdditionalProperties(instance.getAdditionalProperties());
    }
  }
  private ArrayList byVerb = new ArrayList();
  private Long requestCount;
  private String userAgent;
  private String username;
  private Map additionalProperties;
  public A addToByVerb(int index,PerVerbAPIRequestCount item) {
    if (this.byVerb == null) {this.byVerb = new ArrayList();}
    PerVerbAPIRequestCountBuilder builder = new PerVerbAPIRequestCountBuilder(item);
    if (index < 0 || index >= byVerb.size()) { _visitables.get("byVerb").add(builder); byVerb.add(builder); } else { _visitables.get("byVerb").add(index, builder); byVerb.add(index, builder);}
    return (A)this;
  }
  public A setToByVerb(int index,PerVerbAPIRequestCount item) {
    if (this.byVerb == null) {this.byVerb = new ArrayList();}
    PerVerbAPIRequestCountBuilder builder = new PerVerbAPIRequestCountBuilder(item);
    if (index < 0 || index >= byVerb.size()) { _visitables.get("byVerb").add(builder); byVerb.add(builder); } else { _visitables.get("byVerb").set(index, builder); byVerb.set(index, builder);}
    return (A)this;
  }
  public A addToByVerb(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerVerbAPIRequestCount... items) {
    if (this.byVerb == null) {this.byVerb = new ArrayList();}
    for (PerVerbAPIRequestCount item : items) {PerVerbAPIRequestCountBuilder builder = new PerVerbAPIRequestCountBuilder(item);_visitables.get("byVerb").add(builder);this.byVerb.add(builder);} return (A)this;
  }
  public A addAllToByVerb(Collection items) {
    if (this.byVerb == null) {this.byVerb = new ArrayList();}
    for (PerVerbAPIRequestCount item : items) {PerVerbAPIRequestCountBuilder builder = new PerVerbAPIRequestCountBuilder(item);_visitables.get("byVerb").add(builder);this.byVerb.add(builder);} return (A)this;
  }
  public A removeFromByVerb(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerVerbAPIRequestCount... items) {
    for (PerVerbAPIRequestCount item : items) {PerVerbAPIRequestCountBuilder builder = new PerVerbAPIRequestCountBuilder(item);_visitables.get("byVerb").remove(builder);if (this.byVerb != null) {this.byVerb.remove(builder);}} return (A)this;
  }
  public A removeAllFromByVerb(Collection items) {
    for (PerVerbAPIRequestCount item : items) {PerVerbAPIRequestCountBuilder builder = new PerVerbAPIRequestCountBuilder(item);_visitables.get("byVerb").remove(builder);if (this.byVerb != null) {this.byVerb.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromByVerb(Predicate predicate) {
    if (byVerb == null) return (A) this;
    final Iterator each = byVerb.iterator();
    final List visitables = _visitables.get("byVerb");
    while (each.hasNext()) {
      PerVerbAPIRequestCountBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildByVerb instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getByVerb() {
    return byVerb != null ? build(byVerb) : null;
  }
  public List buildByVerb() {
    return byVerb != null ? build(byVerb) : null;
  }
  public PerVerbAPIRequestCount buildByVerb(int index) {
    return this.byVerb.get(index).build();
  }
  public PerVerbAPIRequestCount buildFirstByVerb() {
    return this.byVerb.get(0).build();
  }
  public PerVerbAPIRequestCount buildLastByVerb() {
    return this.byVerb.get(byVerb.size() - 1).build();
  }
  public PerVerbAPIRequestCount buildMatchingByVerb(Predicate predicate) {
    for (PerVerbAPIRequestCountBuilder item: byVerb) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingByVerb(Predicate predicate) {
    for (PerVerbAPIRequestCountBuilder item: byVerb) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withByVerb(List byVerb) {
    if (this.byVerb != null) { _visitables.get("byVerb").clear();}
    if (byVerb != null) {this.byVerb = new ArrayList(); for (PerVerbAPIRequestCount item : byVerb){this.addToByVerb(item);}} else { this.byVerb = null;} return (A) this;
  }
  public A withByVerb(io.fabric8.openshift.api.model.miscellaneous.apiserver.v1.PerVerbAPIRequestCount... byVerb) {
    if (this.byVerb != null) {this.byVerb.clear(); _visitables.remove("byVerb"); }
    if (byVerb != null) {for (PerVerbAPIRequestCount item :byVerb){ this.addToByVerb(item);}} return (A) this;
  }
  public Boolean hasByVerb() {
    return byVerb != null && !byVerb.isEmpty();
  }
  public A addNewByVerb(Long requestCount,String verb) {
    return (A)addToByVerb(new PerVerbAPIRequestCount(requestCount, verb));
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested addNewByVerb() {
    return new PerUserAPIRequestCountFluentImpl.ByVerbNestedImpl();
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested addNewByVerbLike(PerVerbAPIRequestCount item) {
    return new PerUserAPIRequestCountFluentImpl.ByVerbNestedImpl(-1, item);
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested setNewByVerbLike(int index,PerVerbAPIRequestCount item) {
    return new PerUserAPIRequestCountFluentImpl.ByVerbNestedImpl(index, item);
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested editByVerb(int index) {
    if (byVerb.size() <= index) throw new RuntimeException("Can't edit byVerb. Index exceeds size.");
    return setNewByVerbLike(index, buildByVerb(index));
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested editFirstByVerb() {
    if (byVerb.size() == 0) throw new RuntimeException("Can't edit first byVerb. The list is empty.");
    return setNewByVerbLike(0, buildByVerb(0));
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested editLastByVerb() {
    int index = byVerb.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last byVerb. The list is empty.");
    return setNewByVerbLike(index, buildByVerb(index));
  }
  public PerUserAPIRequestCountFluentImpl.ByVerbNested editMatchingByVerb(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;
    PerUserAPIRequestCountFluentImpl that = (PerUserAPIRequestCountFluentImpl) o;
    if (!java.util.Objects.equals(byVerb, that.byVerb)) return false;

    if (!java.util.Objects.equals(requestCount, that.requestCount)) return false;

    if (!java.util.Objects.equals(userAgent, that.userAgent)) return false;

    if (!java.util.Objects.equals(username, that.username)) return false;

    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;

    return true;
  }
  public int hashCode() {
    return java.util.Objects.hash(byVerb,  requestCount,  userAgent,  username,  additionalProperties,  super.hashCode());
  }
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (byVerb != null) { sb.append("byVerb:"); sb.append(byVerb + ","); }
    if (requestCount != null) { sb.append("requestCount:"); sb.append(requestCount + ","); }
    if (userAgent != null) { sb.append("userAgent:"); sb.append(userAgent + ","); }
    if (username != null) { sb.append("username:"); sb.append(username + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  class ByVerbNestedImpl extends PerVerbAPIRequestCountFluentImpl> implements PerUserAPIRequestCountFluentImpl.ByVerbNested,Nested{
    ByVerbNestedImpl(int index,PerVerbAPIRequestCount item) {
      this.index = index;
      this.builder = new PerVerbAPIRequestCountBuilder(this, item);
    }
    ByVerbNestedImpl() {
      this.index = -1;
      this.builder = new PerVerbAPIRequestCountBuilder(this);
    }
    PerVerbAPIRequestCountBuilder builder;
    int index;
    public N and() {
      return (N) PerUserAPIRequestCountFluentImpl.this.setToByVerb(index,builder.build());
    }
    public N endByVerb() {
      return and();
    }
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy