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

io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluentImpl Maven / Gradle / Ivy

package io.fabric8.kubernetes.api.model.rbac;

import io.fabric8.kubernetes.api.model.LabelSelectorBuilder;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import io.fabric8.kubernetes.api.model.LabelSelectorFluentImpl;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.fabric8.kubernetes.api.model.LabelSelector;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import java.lang.Integer;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
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
  */
public class AggregationRuleFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent{
  public AggregationRuleFluentImpl() {
  }
  public AggregationRuleFluentImpl(io.fabric8.kubernetes.api.model.rbac.AggregationRule instance) {
    this.withClusterRoleSelectors(instance.getClusterRoleSelectors()); 
    this.withAdditionalProperties(instance.getAdditionalProperties());

  }
  private java.util.List clusterRoleSelectors =  new java.util.ArrayList();
  private java.util.Map additionalProperties;
  public A addToClusterRoleSelectors(java.lang.Integer index,io.fabric8.kubernetes.api.model.LabelSelector item) {
    if (this.clusterRoleSelectors == null) {this.clusterRoleSelectors = new java.util.ArrayList();}
    io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(item);_visitables.get("clusterRoleSelectors").add(index >= 0 ? index : _visitables.get("clusterRoleSelectors").size(), builder);this.clusterRoleSelectors.add(index >= 0 ? index : clusterRoleSelectors.size(), builder); return (A)this;
  }
  public A setToClusterRoleSelectors(java.lang.Integer index,io.fabric8.kubernetes.api.model.LabelSelector item) {
    if (this.clusterRoleSelectors == null) {this.clusterRoleSelectors = new java.util.ArrayList();}
    io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(item);
    if (index < 0 || index >= _visitables.get("clusterRoleSelectors").size()) { _visitables.get("clusterRoleSelectors").add(builder); } else { _visitables.get("clusterRoleSelectors").set(index, builder);}
    if (index < 0 || index >= clusterRoleSelectors.size()) { clusterRoleSelectors.add(builder); } else { clusterRoleSelectors.set(index, builder);}
     return (A)this;
  }
  public A addToClusterRoleSelectors(io.fabric8.kubernetes.api.model.LabelSelector... items) {
    if (this.clusterRoleSelectors == null) {this.clusterRoleSelectors = new java.util.ArrayList();}
    for (io.fabric8.kubernetes.api.model.LabelSelector item : items) {io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(item);_visitables.get("clusterRoleSelectors").add(builder);this.clusterRoleSelectors.add(builder);} return (A)this;
  }
  public A addAllToClusterRoleSelectors(java.util.Collection items) {
    if (this.clusterRoleSelectors == null) {this.clusterRoleSelectors = new java.util.ArrayList();}
    for (io.fabric8.kubernetes.api.model.LabelSelector item : items) {io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(item);_visitables.get("clusterRoleSelectors").add(builder);this.clusterRoleSelectors.add(builder);} return (A)this;
  }
  public A removeFromClusterRoleSelectors(io.fabric8.kubernetes.api.model.LabelSelector... items) {
    for (io.fabric8.kubernetes.api.model.LabelSelector item : items) {io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(item);_visitables.get("clusterRoleSelectors").remove(builder);if (this.clusterRoleSelectors != null) {this.clusterRoleSelectors.remove(builder);}} return (A)this;
  }
  public A removeAllFromClusterRoleSelectors(java.util.Collection items) {
    for (io.fabric8.kubernetes.api.model.LabelSelector item : items) {io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(item);_visitables.get("clusterRoleSelectors").remove(builder);if (this.clusterRoleSelectors != null) {this.clusterRoleSelectors.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromClusterRoleSelectors(java.util.function.Predicate predicate) {
    if (clusterRoleSelectors == null) return (A) this;
    final Iterator each = clusterRoleSelectors.iterator();
    final List visitables = _visitables.get("clusterRoleSelectors");
    while (each.hasNext()) {
      io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildClusterRoleSelectors instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public java.util.List getClusterRoleSelectors() {
    return build(clusterRoleSelectors);
  }
  public java.util.List buildClusterRoleSelectors() {
    return build(clusterRoleSelectors);
  }
  public io.fabric8.kubernetes.api.model.LabelSelector buildClusterRoleSelector(java.lang.Integer index) {
    return this.clusterRoleSelectors.get(index).build();
  }
  public io.fabric8.kubernetes.api.model.LabelSelector buildFirstClusterRoleSelector() {
    return this.clusterRoleSelectors.get(0).build();
  }
  public io.fabric8.kubernetes.api.model.LabelSelector buildLastClusterRoleSelector() {
    return this.clusterRoleSelectors.get(clusterRoleSelectors.size() - 1).build();
  }
  public io.fabric8.kubernetes.api.model.LabelSelector buildMatchingClusterRoleSelector(java.util.function.Predicate predicate) {
    for (io.fabric8.kubernetes.api.model.LabelSelectorBuilder item: clusterRoleSelectors) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public java.lang.Boolean hasMatchingClusterRoleSelector(java.util.function.Predicate predicate) {
    for (io.fabric8.kubernetes.api.model.LabelSelectorBuilder item: clusterRoleSelectors) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withClusterRoleSelectors(java.util.List clusterRoleSelectors) {
    if (this.clusterRoleSelectors != null) { _visitables.get("clusterRoleSelectors").removeAll(this.clusterRoleSelectors);}
    if (clusterRoleSelectors != null) {this.clusterRoleSelectors = new java.util.ArrayList(); for (io.fabric8.kubernetes.api.model.LabelSelector item : clusterRoleSelectors){this.addToClusterRoleSelectors(item);}} else { this.clusterRoleSelectors = null;} return (A) this;
  }
  public A withClusterRoleSelectors(io.fabric8.kubernetes.api.model.LabelSelector... clusterRoleSelectors) {
    if (this.clusterRoleSelectors != null) {this.clusterRoleSelectors.clear();}
    if (clusterRoleSelectors != null) {for (io.fabric8.kubernetes.api.model.LabelSelector item :clusterRoleSelectors){ this.addToClusterRoleSelectors(item);}} return (A) this;
  }
  public java.lang.Boolean hasClusterRoleSelectors() {
    return clusterRoleSelectors != null && !clusterRoleSelectors.isEmpty();
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested addNewClusterRoleSelector() {
    return new io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluentImpl.ClusterRoleSelectorsNestedImpl();
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested addNewClusterRoleSelectorLike(io.fabric8.kubernetes.api.model.LabelSelector item) {
    return new io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluentImpl.ClusterRoleSelectorsNestedImpl(-1, item);
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested setNewClusterRoleSelectorLike(java.lang.Integer index,io.fabric8.kubernetes.api.model.LabelSelector item) {
    return new io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluentImpl.ClusterRoleSelectorsNestedImpl(index, item);
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested editClusterRoleSelector(java.lang.Integer index) {
    if (clusterRoleSelectors.size() <= index) throw new RuntimeException("Can't edit clusterRoleSelectors. Index exceeds size.");
    return setNewClusterRoleSelectorLike(index, buildClusterRoleSelector(index));
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested editFirstClusterRoleSelector() {
    if (clusterRoleSelectors.size() == 0) throw new RuntimeException("Can't edit first clusterRoleSelectors. The list is empty.");
    return setNewClusterRoleSelectorLike(0, buildClusterRoleSelector(0));
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested editLastClusterRoleSelector() {
    int index = clusterRoleSelectors.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last clusterRoleSelectors. The list is empty.");
    return setNewClusterRoleSelectorLike(index, buildClusterRoleSelector(index));
  }
  public io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested editMatchingClusterRoleSelector(java.util.function.Predicate predicate) {
    int index = -1;
    for (int i=0;i map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new java.util.LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  public A removeFromAdditionalProperties(java.lang.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(java.util.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 java.util.Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  public A withAdditionalProperties(java.util.Map additionalProperties) {
    if (additionalProperties == null) { this.additionalProperties =  null;} else {this.additionalProperties = new java.util.LinkedHashMap(additionalProperties);} return (A) this;
  }
  public java.lang.Boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  public boolean equals(java.lang.Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    AggregationRuleFluentImpl that = (AggregationRuleFluentImpl) o;
    if (clusterRoleSelectors != null ? !clusterRoleSelectors.equals(that.clusterRoleSelectors) :that.clusterRoleSelectors != 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(clusterRoleSelectors,  additionalProperties,  super.hashCode());
  }
  public class ClusterRoleSelectorsNestedImpl extends io.fabric8.kubernetes.api.model.LabelSelectorFluentImpl> implements io.fabric8.kubernetes.api.model.rbac.AggregationRuleFluent.ClusterRoleSelectorsNested,io.fabric8.kubernetes.api.builder.Nested{
    ClusterRoleSelectorsNestedImpl(java.lang.Integer index,io.fabric8.kubernetes.api.model.LabelSelector item) {
      this.index = index;
      this.builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(this, item);
    }
    ClusterRoleSelectorsNestedImpl() {
      this.index = -1;
      this.builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(this);
    }
    io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder;
    java.lang.Integer index;
    public N and() {
      return (N) AggregationRuleFluentImpl.this.setToClusterRoleSelectors(index,builder.build());
    }
    public N endClusterRoleSelector() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy