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

io.kubernetes.client.openapi.models.V1alpha1ValidatingAdmissionPolicySpecFluent Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
package io.kubernetes.client.openapi.models;

import io.kubernetes.client.fluent.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.util.Collection;
import java.lang.Object;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class V1alpha1ValidatingAdmissionPolicySpecFluent> extends BaseFluent{
  public V1alpha1ValidatingAdmissionPolicySpecFluent() {
  }
  
  public V1alpha1ValidatingAdmissionPolicySpecFluent(V1alpha1ValidatingAdmissionPolicySpec instance) {
    this.copyInstance(instance);
  }
  private ArrayList auditAnnotations;
  private String failurePolicy;
  private ArrayList matchConditions;
  private V1alpha1MatchResourcesBuilder matchConstraints;
  private V1alpha1ParamKindBuilder paramKind;
  private ArrayList validations;
  private ArrayList variables;
  
  protected void copyInstance(V1alpha1ValidatingAdmissionPolicySpec instance) {
    instance = (instance != null ? instance : new V1alpha1ValidatingAdmissionPolicySpec());
    if (instance != null) {
          this.withAuditAnnotations(instance.getAuditAnnotations());
          this.withFailurePolicy(instance.getFailurePolicy());
          this.withMatchConditions(instance.getMatchConditions());
          this.withMatchConstraints(instance.getMatchConstraints());
          this.withParamKind(instance.getParamKind());
          this.withValidations(instance.getValidations());
          this.withVariables(instance.getVariables());
        }
  }
  
  public A addToAuditAnnotations(int index,V1alpha1AuditAnnotation item) {
    if (this.auditAnnotations == null) {this.auditAnnotations = new ArrayList();}
    V1alpha1AuditAnnotationBuilder builder = new V1alpha1AuditAnnotationBuilder(item);
    if (index < 0 || index >= auditAnnotations.size()) { _visitables.get("auditAnnotations").add(builder); auditAnnotations.add(builder); } else { _visitables.get("auditAnnotations").add(index, builder); auditAnnotations.add(index, builder);}
    return (A)this;
  }
  
  public A setToAuditAnnotations(int index,V1alpha1AuditAnnotation item) {
    if (this.auditAnnotations == null) {this.auditAnnotations = new ArrayList();}
    V1alpha1AuditAnnotationBuilder builder = new V1alpha1AuditAnnotationBuilder(item);
    if (index < 0 || index >= auditAnnotations.size()) { _visitables.get("auditAnnotations").add(builder); auditAnnotations.add(builder); } else { _visitables.get("auditAnnotations").set(index, builder); auditAnnotations.set(index, builder);}
    return (A)this;
  }
  
  public A addToAuditAnnotations(io.kubernetes.client.openapi.models.V1alpha1AuditAnnotation... items) {
    if (this.auditAnnotations == null) {this.auditAnnotations = new ArrayList();}
    for (V1alpha1AuditAnnotation item : items) {V1alpha1AuditAnnotationBuilder builder = new V1alpha1AuditAnnotationBuilder(item);_visitables.get("auditAnnotations").add(builder);this.auditAnnotations.add(builder);} return (A)this;
  }
  
  public A addAllToAuditAnnotations(Collection items) {
    if (this.auditAnnotations == null) {this.auditAnnotations = new ArrayList();}
    for (V1alpha1AuditAnnotation item : items) {V1alpha1AuditAnnotationBuilder builder = new V1alpha1AuditAnnotationBuilder(item);_visitables.get("auditAnnotations").add(builder);this.auditAnnotations.add(builder);} return (A)this;
  }
  
  public A removeFromAuditAnnotations(io.kubernetes.client.openapi.models.V1alpha1AuditAnnotation... items) {
    if (this.auditAnnotations == null) return (A)this;
    for (V1alpha1AuditAnnotation item : items) {V1alpha1AuditAnnotationBuilder builder = new V1alpha1AuditAnnotationBuilder(item);_visitables.get("auditAnnotations").remove(builder); this.auditAnnotations.remove(builder);} return (A)this;
  }
  
  public A removeAllFromAuditAnnotations(Collection items) {
    if (this.auditAnnotations == null) return (A)this;
    for (V1alpha1AuditAnnotation item : items) {V1alpha1AuditAnnotationBuilder builder = new V1alpha1AuditAnnotationBuilder(item);_visitables.get("auditAnnotations").remove(builder); this.auditAnnotations.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromAuditAnnotations(Predicate predicate) {
    if (auditAnnotations == null) return (A) this;
    final Iterator each = auditAnnotations.iterator();
    final List visitables = _visitables.get("auditAnnotations");
    while (each.hasNext()) {
      V1alpha1AuditAnnotationBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildAuditAnnotations() {
    return this.auditAnnotations != null ? build(auditAnnotations) : null;
  }
  
  public V1alpha1AuditAnnotation buildAuditAnnotation(int index) {
    return this.auditAnnotations.get(index).build();
  }
  
  public V1alpha1AuditAnnotation buildFirstAuditAnnotation() {
    return this.auditAnnotations.get(0).build();
  }
  
  public V1alpha1AuditAnnotation buildLastAuditAnnotation() {
    return this.auditAnnotations.get(auditAnnotations.size() - 1).build();
  }
  
  public V1alpha1AuditAnnotation buildMatchingAuditAnnotation(Predicate predicate) {
      for (V1alpha1AuditAnnotationBuilder item : auditAnnotations) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingAuditAnnotation(Predicate predicate) {
      for (V1alpha1AuditAnnotationBuilder item : auditAnnotations) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withAuditAnnotations(List auditAnnotations) {
    if (this.auditAnnotations != null) {
      this._visitables.get("auditAnnotations").clear();
    }
    if (auditAnnotations != null) {
        this.auditAnnotations = new ArrayList();
        for (V1alpha1AuditAnnotation item : auditAnnotations) {
          this.addToAuditAnnotations(item);
        }
    } else {
      this.auditAnnotations = null;
    }
    return (A) this;
  }
  
  public A withAuditAnnotations(io.kubernetes.client.openapi.models.V1alpha1AuditAnnotation... auditAnnotations) {
    if (this.auditAnnotations != null) {
        this.auditAnnotations.clear();
        _visitables.remove("auditAnnotations");
    }
    if (auditAnnotations != null) {
      for (V1alpha1AuditAnnotation item : auditAnnotations) {
        this.addToAuditAnnotations(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasAuditAnnotations() {
    return this.auditAnnotations != null && !this.auditAnnotations.isEmpty();
  }
  
  public AuditAnnotationsNested addNewAuditAnnotation() {
    return new AuditAnnotationsNested(-1, null);
  }
  
  public AuditAnnotationsNested addNewAuditAnnotationLike(V1alpha1AuditAnnotation item) {
    return new AuditAnnotationsNested(-1, item);
  }
  
  public AuditAnnotationsNested setNewAuditAnnotationLike(int index,V1alpha1AuditAnnotation item) {
    return new AuditAnnotationsNested(index, item);
  }
  
  public AuditAnnotationsNested editAuditAnnotation(int index) {
    if (auditAnnotations.size() <= index) throw new RuntimeException("Can't edit auditAnnotations. Index exceeds size.");
    return setNewAuditAnnotationLike(index, buildAuditAnnotation(index));
  }
  
  public AuditAnnotationsNested editFirstAuditAnnotation() {
    if (auditAnnotations.size() == 0) throw new RuntimeException("Can't edit first auditAnnotations. The list is empty.");
    return setNewAuditAnnotationLike(0, buildAuditAnnotation(0));
  }
  
  public AuditAnnotationsNested editLastAuditAnnotation() {
    int index = auditAnnotations.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last auditAnnotations. The list is empty.");
    return setNewAuditAnnotationLike(index, buildAuditAnnotation(index));
  }
  
  public AuditAnnotationsNested editMatchingAuditAnnotation(Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    V1alpha1MatchConditionBuilder builder = new V1alpha1MatchConditionBuilder(item);
    if (index < 0 || index >= matchConditions.size()) { _visitables.get("matchConditions").add(builder); matchConditions.add(builder); } else { _visitables.get("matchConditions").add(index, builder); matchConditions.add(index, builder);}
    return (A)this;
  }
  
  public A setToMatchConditions(int index,V1alpha1MatchCondition item) {
    if (this.matchConditions == null) {this.matchConditions = new ArrayList();}
    V1alpha1MatchConditionBuilder builder = new V1alpha1MatchConditionBuilder(item);
    if (index < 0 || index >= matchConditions.size()) { _visitables.get("matchConditions").add(builder); matchConditions.add(builder); } else { _visitables.get("matchConditions").set(index, builder); matchConditions.set(index, builder);}
    return (A)this;
  }
  
  public A addToMatchConditions(io.kubernetes.client.openapi.models.V1alpha1MatchCondition... items) {
    if (this.matchConditions == null) {this.matchConditions = new ArrayList();}
    for (V1alpha1MatchCondition item : items) {V1alpha1MatchConditionBuilder builder = new V1alpha1MatchConditionBuilder(item);_visitables.get("matchConditions").add(builder);this.matchConditions.add(builder);} return (A)this;
  }
  
  public A addAllToMatchConditions(Collection items) {
    if (this.matchConditions == null) {this.matchConditions = new ArrayList();}
    for (V1alpha1MatchCondition item : items) {V1alpha1MatchConditionBuilder builder = new V1alpha1MatchConditionBuilder(item);_visitables.get("matchConditions").add(builder);this.matchConditions.add(builder);} return (A)this;
  }
  
  public A removeFromMatchConditions(io.kubernetes.client.openapi.models.V1alpha1MatchCondition... items) {
    if (this.matchConditions == null) return (A)this;
    for (V1alpha1MatchCondition item : items) {V1alpha1MatchConditionBuilder builder = new V1alpha1MatchConditionBuilder(item);_visitables.get("matchConditions").remove(builder); this.matchConditions.remove(builder);} return (A)this;
  }
  
  public A removeAllFromMatchConditions(Collection items) {
    if (this.matchConditions == null) return (A)this;
    for (V1alpha1MatchCondition item : items) {V1alpha1MatchConditionBuilder builder = new V1alpha1MatchConditionBuilder(item);_visitables.get("matchConditions").remove(builder); this.matchConditions.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromMatchConditions(Predicate predicate) {
    if (matchConditions == null) return (A) this;
    final Iterator each = matchConditions.iterator();
    final List visitables = _visitables.get("matchConditions");
    while (each.hasNext()) {
      V1alpha1MatchConditionBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildMatchConditions() {
    return this.matchConditions != null ? build(matchConditions) : null;
  }
  
  public V1alpha1MatchCondition buildMatchCondition(int index) {
    return this.matchConditions.get(index).build();
  }
  
  public V1alpha1MatchCondition buildFirstMatchCondition() {
    return this.matchConditions.get(0).build();
  }
  
  public V1alpha1MatchCondition buildLastMatchCondition() {
    return this.matchConditions.get(matchConditions.size() - 1).build();
  }
  
  public V1alpha1MatchCondition buildMatchingMatchCondition(Predicate predicate) {
      for (V1alpha1MatchConditionBuilder item : matchConditions) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingMatchCondition(Predicate predicate) {
      for (V1alpha1MatchConditionBuilder item : matchConditions) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withMatchConditions(List matchConditions) {
    if (this.matchConditions != null) {
      this._visitables.get("matchConditions").clear();
    }
    if (matchConditions != null) {
        this.matchConditions = new ArrayList();
        for (V1alpha1MatchCondition item : matchConditions) {
          this.addToMatchConditions(item);
        }
    } else {
      this.matchConditions = null;
    }
    return (A) this;
  }
  
  public A withMatchConditions(io.kubernetes.client.openapi.models.V1alpha1MatchCondition... matchConditions) {
    if (this.matchConditions != null) {
        this.matchConditions.clear();
        _visitables.remove("matchConditions");
    }
    if (matchConditions != null) {
      for (V1alpha1MatchCondition item : matchConditions) {
        this.addToMatchConditions(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasMatchConditions() {
    return this.matchConditions != null && !this.matchConditions.isEmpty();
  }
  
  public MatchConditionsNested addNewMatchCondition() {
    return new MatchConditionsNested(-1, null);
  }
  
  public MatchConditionsNested addNewMatchConditionLike(V1alpha1MatchCondition item) {
    return new MatchConditionsNested(-1, item);
  }
  
  public MatchConditionsNested setNewMatchConditionLike(int index,V1alpha1MatchCondition item) {
    return new MatchConditionsNested(index, item);
  }
  
  public MatchConditionsNested editMatchCondition(int index) {
    if (matchConditions.size() <= index) throw new RuntimeException("Can't edit matchConditions. Index exceeds size.");
    return setNewMatchConditionLike(index, buildMatchCondition(index));
  }
  
  public MatchConditionsNested editFirstMatchCondition() {
    if (matchConditions.size() == 0) throw new RuntimeException("Can't edit first matchConditions. The list is empty.");
    return setNewMatchConditionLike(0, buildMatchCondition(0));
  }
  
  public MatchConditionsNested editLastMatchCondition() {
    int index = matchConditions.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last matchConditions. The list is empty.");
    return setNewMatchConditionLike(index, buildMatchCondition(index));
  }
  
  public MatchConditionsNested editMatchingMatchCondition(Predicate predicate) {
    int index = -1;
    for (int i=0;i withNewMatchConstraints() {
    return new MatchConstraintsNested(null);
  }
  
  public MatchConstraintsNested withNewMatchConstraintsLike(V1alpha1MatchResources item) {
    return new MatchConstraintsNested(item);
  }
  
  public MatchConstraintsNested editMatchConstraints() {
    return withNewMatchConstraintsLike(java.util.Optional.ofNullable(buildMatchConstraints()).orElse(null));
  }
  
  public MatchConstraintsNested editOrNewMatchConstraints() {
    return withNewMatchConstraintsLike(java.util.Optional.ofNullable(buildMatchConstraints()).orElse(new V1alpha1MatchResourcesBuilder().build()));
  }
  
  public MatchConstraintsNested editOrNewMatchConstraintsLike(V1alpha1MatchResources item) {
    return withNewMatchConstraintsLike(java.util.Optional.ofNullable(buildMatchConstraints()).orElse(item));
  }
  
  public V1alpha1ParamKind buildParamKind() {
    return this.paramKind != null ? this.paramKind.build() : null;
  }
  
  public A withParamKind(V1alpha1ParamKind paramKind) {
    this._visitables.remove("paramKind");
    if (paramKind != null) {
        this.paramKind = new V1alpha1ParamKindBuilder(paramKind);
        this._visitables.get("paramKind").add(this.paramKind);
    } else {
        this.paramKind = null;
        this._visitables.get("paramKind").remove(this.paramKind);
    }
    return (A) this;
  }
  
  public boolean hasParamKind() {
    return this.paramKind != null;
  }
  
  public ParamKindNested withNewParamKind() {
    return new ParamKindNested(null);
  }
  
  public ParamKindNested withNewParamKindLike(V1alpha1ParamKind item) {
    return new ParamKindNested(item);
  }
  
  public ParamKindNested editParamKind() {
    return withNewParamKindLike(java.util.Optional.ofNullable(buildParamKind()).orElse(null));
  }
  
  public ParamKindNested editOrNewParamKind() {
    return withNewParamKindLike(java.util.Optional.ofNullable(buildParamKind()).orElse(new V1alpha1ParamKindBuilder().build()));
  }
  
  public ParamKindNested editOrNewParamKindLike(V1alpha1ParamKind item) {
    return withNewParamKindLike(java.util.Optional.ofNullable(buildParamKind()).orElse(item));
  }
  
  public A addToValidations(int index,V1alpha1Validation item) {
    if (this.validations == null) {this.validations = new ArrayList();}
    V1alpha1ValidationBuilder builder = new V1alpha1ValidationBuilder(item);
    if (index < 0 || index >= validations.size()) { _visitables.get("validations").add(builder); validations.add(builder); } else { _visitables.get("validations").add(index, builder); validations.add(index, builder);}
    return (A)this;
  }
  
  public A setToValidations(int index,V1alpha1Validation item) {
    if (this.validations == null) {this.validations = new ArrayList();}
    V1alpha1ValidationBuilder builder = new V1alpha1ValidationBuilder(item);
    if (index < 0 || index >= validations.size()) { _visitables.get("validations").add(builder); validations.add(builder); } else { _visitables.get("validations").set(index, builder); validations.set(index, builder);}
    return (A)this;
  }
  
  public A addToValidations(io.kubernetes.client.openapi.models.V1alpha1Validation... items) {
    if (this.validations == null) {this.validations = new ArrayList();}
    for (V1alpha1Validation item : items) {V1alpha1ValidationBuilder builder = new V1alpha1ValidationBuilder(item);_visitables.get("validations").add(builder);this.validations.add(builder);} return (A)this;
  }
  
  public A addAllToValidations(Collection items) {
    if (this.validations == null) {this.validations = new ArrayList();}
    for (V1alpha1Validation item : items) {V1alpha1ValidationBuilder builder = new V1alpha1ValidationBuilder(item);_visitables.get("validations").add(builder);this.validations.add(builder);} return (A)this;
  }
  
  public A removeFromValidations(io.kubernetes.client.openapi.models.V1alpha1Validation... items) {
    if (this.validations == null) return (A)this;
    for (V1alpha1Validation item : items) {V1alpha1ValidationBuilder builder = new V1alpha1ValidationBuilder(item);_visitables.get("validations").remove(builder); this.validations.remove(builder);} return (A)this;
  }
  
  public A removeAllFromValidations(Collection items) {
    if (this.validations == null) return (A)this;
    for (V1alpha1Validation item : items) {V1alpha1ValidationBuilder builder = new V1alpha1ValidationBuilder(item);_visitables.get("validations").remove(builder); this.validations.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromValidations(Predicate predicate) {
    if (validations == null) return (A) this;
    final Iterator each = validations.iterator();
    final List visitables = _visitables.get("validations");
    while (each.hasNext()) {
      V1alpha1ValidationBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildValidations() {
    return this.validations != null ? build(validations) : null;
  }
  
  public V1alpha1Validation buildValidation(int index) {
    return this.validations.get(index).build();
  }
  
  public V1alpha1Validation buildFirstValidation() {
    return this.validations.get(0).build();
  }
  
  public V1alpha1Validation buildLastValidation() {
    return this.validations.get(validations.size() - 1).build();
  }
  
  public V1alpha1Validation buildMatchingValidation(Predicate predicate) {
      for (V1alpha1ValidationBuilder item : validations) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingValidation(Predicate predicate) {
      for (V1alpha1ValidationBuilder item : validations) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withValidations(List validations) {
    if (this.validations != null) {
      this._visitables.get("validations").clear();
    }
    if (validations != null) {
        this.validations = new ArrayList();
        for (V1alpha1Validation item : validations) {
          this.addToValidations(item);
        }
    } else {
      this.validations = null;
    }
    return (A) this;
  }
  
  public A withValidations(io.kubernetes.client.openapi.models.V1alpha1Validation... validations) {
    if (this.validations != null) {
        this.validations.clear();
        _visitables.remove("validations");
    }
    if (validations != null) {
      for (V1alpha1Validation item : validations) {
        this.addToValidations(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasValidations() {
    return this.validations != null && !this.validations.isEmpty();
  }
  
  public ValidationsNested addNewValidation() {
    return new ValidationsNested(-1, null);
  }
  
  public ValidationsNested addNewValidationLike(V1alpha1Validation item) {
    return new ValidationsNested(-1, item);
  }
  
  public ValidationsNested setNewValidationLike(int index,V1alpha1Validation item) {
    return new ValidationsNested(index, item);
  }
  
  public ValidationsNested editValidation(int index) {
    if (validations.size() <= index) throw new RuntimeException("Can't edit validations. Index exceeds size.");
    return setNewValidationLike(index, buildValidation(index));
  }
  
  public ValidationsNested editFirstValidation() {
    if (validations.size() == 0) throw new RuntimeException("Can't edit first validations. The list is empty.");
    return setNewValidationLike(0, buildValidation(0));
  }
  
  public ValidationsNested editLastValidation() {
    int index = validations.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last validations. The list is empty.");
    return setNewValidationLike(index, buildValidation(index));
  }
  
  public ValidationsNested editMatchingValidation(Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    V1alpha1VariableBuilder builder = new V1alpha1VariableBuilder(item);
    if (index < 0 || index >= variables.size()) { _visitables.get("variables").add(builder); variables.add(builder); } else { _visitables.get("variables").add(index, builder); variables.add(index, builder);}
    return (A)this;
  }
  
  public A setToVariables(int index,V1alpha1Variable item) {
    if (this.variables == null) {this.variables = new ArrayList();}
    V1alpha1VariableBuilder builder = new V1alpha1VariableBuilder(item);
    if (index < 0 || index >= variables.size()) { _visitables.get("variables").add(builder); variables.add(builder); } else { _visitables.get("variables").set(index, builder); variables.set(index, builder);}
    return (A)this;
  }
  
  public A addToVariables(io.kubernetes.client.openapi.models.V1alpha1Variable... items) {
    if (this.variables == null) {this.variables = new ArrayList();}
    for (V1alpha1Variable item : items) {V1alpha1VariableBuilder builder = new V1alpha1VariableBuilder(item);_visitables.get("variables").add(builder);this.variables.add(builder);} return (A)this;
  }
  
  public A addAllToVariables(Collection items) {
    if (this.variables == null) {this.variables = new ArrayList();}
    for (V1alpha1Variable item : items) {V1alpha1VariableBuilder builder = new V1alpha1VariableBuilder(item);_visitables.get("variables").add(builder);this.variables.add(builder);} return (A)this;
  }
  
  public A removeFromVariables(io.kubernetes.client.openapi.models.V1alpha1Variable... items) {
    if (this.variables == null) return (A)this;
    for (V1alpha1Variable item : items) {V1alpha1VariableBuilder builder = new V1alpha1VariableBuilder(item);_visitables.get("variables").remove(builder); this.variables.remove(builder);} return (A)this;
  }
  
  public A removeAllFromVariables(Collection items) {
    if (this.variables == null) return (A)this;
    for (V1alpha1Variable item : items) {V1alpha1VariableBuilder builder = new V1alpha1VariableBuilder(item);_visitables.get("variables").remove(builder); this.variables.remove(builder);} return (A)this;
  }
  
  public A removeMatchingFromVariables(Predicate predicate) {
    if (variables == null) return (A) this;
    final Iterator each = variables.iterator();
    final List visitables = _visitables.get("variables");
    while (each.hasNext()) {
      V1alpha1VariableBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  public List buildVariables() {
    return this.variables != null ? build(variables) : null;
  }
  
  public V1alpha1Variable buildVariable(int index) {
    return this.variables.get(index).build();
  }
  
  public V1alpha1Variable buildFirstVariable() {
    return this.variables.get(0).build();
  }
  
  public V1alpha1Variable buildLastVariable() {
    return this.variables.get(variables.size() - 1).build();
  }
  
  public V1alpha1Variable buildMatchingVariable(Predicate predicate) {
      for (V1alpha1VariableBuilder item : variables) {
        if (predicate.test(item)) {
          return item.build();
        }
      }
      return null;
  }
  
  public boolean hasMatchingVariable(Predicate predicate) {
      for (V1alpha1VariableBuilder item : variables) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withVariables(List variables) {
    if (this.variables != null) {
      this._visitables.get("variables").clear();
    }
    if (variables != null) {
        this.variables = new ArrayList();
        for (V1alpha1Variable item : variables) {
          this.addToVariables(item);
        }
    } else {
      this.variables = null;
    }
    return (A) this;
  }
  
  public A withVariables(io.kubernetes.client.openapi.models.V1alpha1Variable... variables) {
    if (this.variables != null) {
        this.variables.clear();
        _visitables.remove("variables");
    }
    if (variables != null) {
      for (V1alpha1Variable item : variables) {
        this.addToVariables(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasVariables() {
    return this.variables != null && !this.variables.isEmpty();
  }
  
  public VariablesNested addNewVariable() {
    return new VariablesNested(-1, null);
  }
  
  public VariablesNested addNewVariableLike(V1alpha1Variable item) {
    return new VariablesNested(-1, item);
  }
  
  public VariablesNested setNewVariableLike(int index,V1alpha1Variable item) {
    return new VariablesNested(index, item);
  }
  
  public VariablesNested editVariable(int index) {
    if (variables.size() <= index) throw new RuntimeException("Can't edit variables. Index exceeds size.");
    return setNewVariableLike(index, buildVariable(index));
  }
  
  public VariablesNested editFirstVariable() {
    if (variables.size() == 0) throw new RuntimeException("Can't edit first variables. The list is empty.");
    return setNewVariableLike(0, buildVariable(0));
  }
  
  public VariablesNested editLastVariable() {
    int index = variables.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last variables. The list is empty.");
    return setNewVariableLike(index, buildVariable(index));
  }
  
  public VariablesNested editMatchingVariable(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends V1alpha1AuditAnnotationFluent> implements Nested{
    AuditAnnotationsNested(int index,V1alpha1AuditAnnotation item) {
      this.index = index;
      this.builder = new V1alpha1AuditAnnotationBuilder(this, item);
    }
    V1alpha1AuditAnnotationBuilder builder;
    int index;
    
    public N and() {
      return (N) V1alpha1ValidatingAdmissionPolicySpecFluent.this.setToAuditAnnotations(index,builder.build());
    }
    
    public N endAuditAnnotation() {
      return and();
    }
    
  
  }
  public class MatchConditionsNested extends V1alpha1MatchConditionFluent> implements Nested{
    MatchConditionsNested(int index,V1alpha1MatchCondition item) {
      this.index = index;
      this.builder = new V1alpha1MatchConditionBuilder(this, item);
    }
    V1alpha1MatchConditionBuilder builder;
    int index;
    
    public N and() {
      return (N) V1alpha1ValidatingAdmissionPolicySpecFluent.this.setToMatchConditions(index,builder.build());
    }
    
    public N endMatchCondition() {
      return and();
    }
    
  
  }
  public class MatchConstraintsNested extends V1alpha1MatchResourcesFluent> implements Nested{
    MatchConstraintsNested(V1alpha1MatchResources item) {
      this.builder = new V1alpha1MatchResourcesBuilder(this, item);
    }
    V1alpha1MatchResourcesBuilder builder;
    
    public N and() {
      return (N) V1alpha1ValidatingAdmissionPolicySpecFluent.this.withMatchConstraints(builder.build());
    }
    
    public N endMatchConstraints() {
      return and();
    }
    
  
  }
  public class ParamKindNested extends V1alpha1ParamKindFluent> implements Nested{
    ParamKindNested(V1alpha1ParamKind item) {
      this.builder = new V1alpha1ParamKindBuilder(this, item);
    }
    V1alpha1ParamKindBuilder builder;
    
    public N and() {
      return (N) V1alpha1ValidatingAdmissionPolicySpecFluent.this.withParamKind(builder.build());
    }
    
    public N endParamKind() {
      return and();
    }
    
  
  }
  public class ValidationsNested extends V1alpha1ValidationFluent> implements Nested{
    ValidationsNested(int index,V1alpha1Validation item) {
      this.index = index;
      this.builder = new V1alpha1ValidationBuilder(this, item);
    }
    V1alpha1ValidationBuilder builder;
    int index;
    
    public N and() {
      return (N) V1alpha1ValidatingAdmissionPolicySpecFluent.this.setToValidations(index,builder.build());
    }
    
    public N endValidation() {
      return and();
    }
    
  
  }
  public class VariablesNested extends V1alpha1VariableFluent> implements Nested{
    VariablesNested(int index,V1alpha1Variable item) {
      this.index = index;
      this.builder = new V1alpha1VariableBuilder(this, item);
    }
    V1alpha1VariableBuilder builder;
    int index;
    
    public N and() {
      return (N) V1alpha1ValidatingAdmissionPolicySpecFluent.this.setToVariables(index,builder.build());
    }
    
    public N endVariable() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy