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

io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
package io.fabric8.kubernetes.api.model.flowcontrol.v1beta1;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
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.util.Collection;
import java.lang.Object;
import java.util.Map;

 /**
  * Generated
  */
public class FlowSchemaSpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent{
  public FlowSchemaSpecFluentImpl() {
  }
  public FlowSchemaSpecFluentImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpec instance) {
    this.withDistinguisherMethod(instance.getDistinguisherMethod()); 
    this.withMatchingPrecedence(instance.getMatchingPrecedence()); 
    this.withPriorityLevelConfiguration(instance.getPriorityLevelConfiguration()); 
    this.withRules(instance.getRules()); 
    this.withAdditionalProperties(instance.getAdditionalProperties());

  }
  private io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder distinguisherMethod;
  private java.lang.Integer matchingPrecedence;
  private io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder priorityLevelConfiguration;
  private java.util.List rules =  new java.util.ArrayList();
  private java.util.Map additionalProperties;
  
  /**
   * This method has been deprecated, please use method buildDistinguisherMethod instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod getDistinguisherMethod() {
    return this.distinguisherMethod!=null?this.distinguisherMethod.build():null;
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod buildDistinguisherMethod() {
    return this.distinguisherMethod!=null?this.distinguisherMethod.build():null;
  }
  public A withDistinguisherMethod(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod distinguisherMethod) {
    _visitables.get("distinguisherMethod").remove(this.distinguisherMethod);
    if (distinguisherMethod!=null){ this.distinguisherMethod= new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder(distinguisherMethod); _visitables.get("distinguisherMethod").add(this.distinguisherMethod);} return (A) this;
  }
  public java.lang.Boolean hasDistinguisherMethod() {
    return this.distinguisherMethod != null;
  }
  public A withNewDistinguisherMethod(java.lang.String type) {
    return (A)withDistinguisherMethod(new FlowDistinguisherMethod(type));
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested withNewDistinguisherMethod() {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.DistinguisherMethodNestedImpl();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested withNewDistinguisherMethodLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod item) {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.DistinguisherMethodNestedImpl(item);
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested editDistinguisherMethod() {
    return withNewDistinguisherMethodLike(getDistinguisherMethod());
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested editOrNewDistinguisherMethod() {
    return withNewDistinguisherMethodLike(getDistinguisherMethod() != null ? getDistinguisherMethod(): new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder().build());
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested editOrNewDistinguisherMethodLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod item) {
    return withNewDistinguisherMethodLike(getDistinguisherMethod() != null ? getDistinguisherMethod(): item);
  }
  public java.lang.Integer getMatchingPrecedence() {
    return this.matchingPrecedence;
  }
  public A withMatchingPrecedence(java.lang.Integer matchingPrecedence) {
    this.matchingPrecedence=matchingPrecedence; return (A) this;
  }
  public java.lang.Boolean hasMatchingPrecedence() {
    return this.matchingPrecedence != null;
  }
  
  /**
   * This method has been deprecated, please use method buildPriorityLevelConfiguration instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference getPriorityLevelConfiguration() {
    return this.priorityLevelConfiguration!=null?this.priorityLevelConfiguration.build():null;
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference buildPriorityLevelConfiguration() {
    return this.priorityLevelConfiguration!=null?this.priorityLevelConfiguration.build():null;
  }
  public A withPriorityLevelConfiguration(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference priorityLevelConfiguration) {
    _visitables.get("priorityLevelConfiguration").remove(this.priorityLevelConfiguration);
    if (priorityLevelConfiguration!=null){ this.priorityLevelConfiguration= new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder(priorityLevelConfiguration); _visitables.get("priorityLevelConfiguration").add(this.priorityLevelConfiguration);} return (A) this;
  }
  public java.lang.Boolean hasPriorityLevelConfiguration() {
    return this.priorityLevelConfiguration != null;
  }
  public A withNewPriorityLevelConfiguration(java.lang.String name) {
    return (A)withPriorityLevelConfiguration(new PriorityLevelConfigurationReference(name));
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested withNewPriorityLevelConfiguration() {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.PriorityLevelConfigurationNestedImpl();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested withNewPriorityLevelConfigurationLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference item) {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.PriorityLevelConfigurationNestedImpl(item);
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested editPriorityLevelConfiguration() {
    return withNewPriorityLevelConfigurationLike(getPriorityLevelConfiguration());
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested editOrNewPriorityLevelConfiguration() {
    return withNewPriorityLevelConfigurationLike(getPriorityLevelConfiguration() != null ? getPriorityLevelConfiguration(): new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder().build());
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested editOrNewPriorityLevelConfigurationLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference item) {
    return withNewPriorityLevelConfigurationLike(getPriorityLevelConfiguration() != null ? getPriorityLevelConfiguration(): item);
  }
  public A addToRules(java.lang.Integer index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
    if (this.rules == null) {this.rules = new java.util.ArrayList();}
    io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").add(index >= 0 ? index : _visitables.get("rules").size(), builder);this.rules.add(index >= 0 ? index : rules.size(), builder); return (A)this;
  }
  public A setToRules(java.lang.Integer index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
    if (this.rules == null) {this.rules = new java.util.ArrayList();}
    io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);
    if (index < 0 || index >= _visitables.get("rules").size()) { _visitables.get("rules").add(builder); } else { _visitables.get("rules").set(index, builder);}
    if (index < 0 || index >= rules.size()) { rules.add(builder); } else { rules.set(index, builder);}
     return (A)this;
  }
  public A addToRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects... items) {
    if (this.rules == null) {this.rules = new java.util.ArrayList();}
    for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
  }
  public A addAllToRules(java.util.Collection items) {
    if (this.rules == null) {this.rules = new java.util.ArrayList();}
    for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
  }
  public A removeFromRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects... items) {
    for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
  }
  public A removeAllFromRules(java.util.Collection items) {
    for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromRules(java.util.function.Predicate predicate) {
    if (rules == null) return (A) this;
    final Iterator each = rules.iterator();
    final List visitables = _visitables.get("rules");
    while (each.hasNext()) {
      io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildRules instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public java.util.List getRules() {
    return build(rules);
  }
  public java.util.List buildRules() {
    return build(rules);
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildRule(java.lang.Integer index) {
    return this.rules.get(index).build();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildFirstRule() {
    return this.rules.get(0).build();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildLastRule() {
    return this.rules.get(rules.size() - 1).build();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildMatchingRule(java.util.function.Predicate predicate) {
    for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder item: rules) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public java.lang.Boolean hasMatchingRule(java.util.function.Predicate predicate) {
    for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder item: rules) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withRules(java.util.List rules) {
    if (this.rules != null) { _visitables.get("rules").removeAll(this.rules);}
    if (rules != null) {this.rules = new java.util.ArrayList(); for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : rules){this.addToRules(item);}} else { this.rules = null;} return (A) this;
  }
  public A withRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects... rules) {
    if (this.rules != null) {this.rules.clear();}
    if (rules != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item :rules){ this.addToRules(item);}} return (A) this;
  }
  public java.lang.Boolean hasRules() {
    return rules != null && !rules.isEmpty();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested addNewRule() {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.RulesNestedImpl();
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested addNewRuleLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.RulesNestedImpl(-1, item);
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested setNewRuleLike(java.lang.Integer index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
    return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.RulesNestedImpl(index, item);
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editRule(java.lang.Integer index) {
    if (rules.size() <= index) throw new RuntimeException("Can't edit rules. Index exceeds size.");
    return setNewRuleLike(index, buildRule(index));
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editFirstRule() {
    if (rules.size() == 0) throw new RuntimeException("Can't edit first rules. The list is empty.");
    return setNewRuleLike(0, buildRule(0));
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editLastRule() {
    int index = rules.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last rules. The list is empty.");
    return setNewRuleLike(index, buildRule(index));
  }
  public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editMatchingRule(java.util.function.Predicate predicate) {
    int index = -1;
    for (int i=0;i(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  public A addToAdditionalProperties(java.util.Map 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;
    FlowSchemaSpecFluentImpl that = (FlowSchemaSpecFluentImpl) o;
    if (distinguisherMethod != null ? !distinguisherMethod.equals(that.distinguisherMethod) :that.distinguisherMethod != null) return false;
    if (matchingPrecedence != null ? !matchingPrecedence.equals(that.matchingPrecedence) :that.matchingPrecedence != null) return false;
    if (priorityLevelConfiguration != null ? !priorityLevelConfiguration.equals(that.priorityLevelConfiguration) :that.priorityLevelConfiguration != null) return false;
    if (rules != null ? !rules.equals(that.rules) :that.rules != 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(distinguisherMethod,  matchingPrecedence,  priorityLevelConfiguration,  rules,  additionalProperties,  super.hashCode());
  }
  public class DistinguisherMethodNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested,io.fabric8.kubernetes.api.builder.Nested{
    DistinguisherMethodNestedImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod item) {
      this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder(this, item);
    }
    DistinguisherMethodNestedImpl() {
      this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder(this);
    }
    io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder builder;
    public N and() {
      return (N) FlowSchemaSpecFluentImpl.this.withDistinguisherMethod(builder.build());
    }
    public N endDistinguisherMethod() {
      return and();
    }
    
  }
  public class PriorityLevelConfigurationNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested,io.fabric8.kubernetes.api.builder.Nested{
    PriorityLevelConfigurationNestedImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference item) {
      this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder(this, item);
    }
    PriorityLevelConfigurationNestedImpl() {
      this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder(this);
    }
    io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder builder;
    public N and() {
      return (N) FlowSchemaSpecFluentImpl.this.withPriorityLevelConfiguration(builder.build());
    }
    public N endPriorityLevelConfiguration() {
      return and();
    }
    
  }
  public class RulesNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested,io.fabric8.kubernetes.api.builder.Nested{
    RulesNestedImpl(java.lang.Integer index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
      this.index = index;
      this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(this, item);
    }
    RulesNestedImpl() {
      this.index = -1;
      this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(this);
    }
    io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder;
    java.lang.Integer index;
    public N and() {
      return (N) FlowSchemaSpecFluentImpl.this.setToRules(index,builder.build());
    }
    public N endRule() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy