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

io.kubernetes.client.openapi.models.V1CustomResourceDefinitionSpecFluentImpl 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 java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.util.Collection;
import java.lang.Object;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class V1CustomResourceDefinitionSpecFluentImpl> extends BaseFluent implements V1CustomResourceDefinitionSpecFluent{
  public V1CustomResourceDefinitionSpecFluentImpl() {
  }
  public V1CustomResourceDefinitionSpecFluentImpl(V1CustomResourceDefinitionSpec instance) {
    if (instance != null) {
      this.withConversion(instance.getConversion());
      this.withGroup(instance.getGroup());
      this.withNames(instance.getNames());
      this.withPreserveUnknownFields(instance.getPreserveUnknownFields());
      this.withScope(instance.getScope());
      this.withVersions(instance.getVersions());
    }
  }
  private V1CustomResourceConversionBuilder conversion;
  private String group;
  private V1CustomResourceDefinitionNamesBuilder names;
  private Boolean preserveUnknownFields;
  private String scope;
  private ArrayList versions;
  
  /**
   * This method has been deprecated, please use method buildConversion instead.
   * @return The buildable object.
   */
  @Deprecated
  public V1CustomResourceConversion getConversion() {
    return this.conversion!=null ?this.conversion.build():null;
  }
  public V1CustomResourceConversion buildConversion() {
    return this.conversion!=null ?this.conversion.build():null;
  }
  public A withConversion(V1CustomResourceConversion conversion) {
    _visitables.get("conversion").remove(this.conversion);
    if (conversion!=null){ this.conversion= new V1CustomResourceConversionBuilder(conversion); _visitables.get("conversion").add(this.conversion);} else { this.conversion = null; _visitables.get("conversion").remove(this.conversion); } return (A) this;
  }
  public Boolean hasConversion() {
    return this.conversion != null;
  }
  public V1CustomResourceDefinitionSpecFluentImpl.ConversionNested withNewConversion() {
    return new V1CustomResourceDefinitionSpecFluentImpl.ConversionNestedImpl();
  }
  public V1CustomResourceDefinitionSpecFluentImpl.ConversionNested withNewConversionLike(V1CustomResourceConversion item) {
    return new V1CustomResourceDefinitionSpecFluentImpl.ConversionNestedImpl(item);
  }
  public V1CustomResourceDefinitionSpecFluentImpl.ConversionNested editConversion() {
    return withNewConversionLike(getConversion());
  }
  public V1CustomResourceDefinitionSpecFluentImpl.ConversionNested editOrNewConversion() {
    return withNewConversionLike(getConversion() != null ? getConversion(): new V1CustomResourceConversionBuilder().build());
  }
  public V1CustomResourceDefinitionSpecFluentImpl.ConversionNested editOrNewConversionLike(V1CustomResourceConversion item) {
    return withNewConversionLike(getConversion() != null ? getConversion(): item);
  }
  public String getGroup() {
    return this.group;
  }
  public A withGroup(String group) {
    this.group=group; return (A) this;
  }
  public Boolean hasGroup() {
    return this.group != null;
  }
  
  /**
   * This method has been deprecated, please use method buildNames instead.
   * @return The buildable object.
   */
  @Deprecated
  public V1CustomResourceDefinitionNames getNames() {
    return this.names!=null ?this.names.build():null;
  }
  public V1CustomResourceDefinitionNames buildNames() {
    return this.names!=null ?this.names.build():null;
  }
  public A withNames(V1CustomResourceDefinitionNames names) {
    _visitables.get("names").remove(this.names);
    if (names!=null){ this.names= new V1CustomResourceDefinitionNamesBuilder(names); _visitables.get("names").add(this.names);} else { this.names = null; _visitables.get("names").remove(this.names); } return (A) this;
  }
  public Boolean hasNames() {
    return this.names != null;
  }
  public V1CustomResourceDefinitionSpecFluentImpl.NamesNested withNewNames() {
    return new V1CustomResourceDefinitionSpecFluentImpl.NamesNestedImpl();
  }
  public V1CustomResourceDefinitionSpecFluentImpl.NamesNested withNewNamesLike(V1CustomResourceDefinitionNames item) {
    return new V1CustomResourceDefinitionSpecFluentImpl.NamesNestedImpl(item);
  }
  public V1CustomResourceDefinitionSpecFluentImpl.NamesNested editNames() {
    return withNewNamesLike(getNames());
  }
  public V1CustomResourceDefinitionSpecFluentImpl.NamesNested editOrNewNames() {
    return withNewNamesLike(getNames() != null ? getNames(): new V1CustomResourceDefinitionNamesBuilder().build());
  }
  public V1CustomResourceDefinitionSpecFluentImpl.NamesNested editOrNewNamesLike(V1CustomResourceDefinitionNames item) {
    return withNewNamesLike(getNames() != null ? getNames(): item);
  }
  public Boolean getPreserveUnknownFields() {
    return this.preserveUnknownFields;
  }
  public A withPreserveUnknownFields(Boolean preserveUnknownFields) {
    this.preserveUnknownFields=preserveUnknownFields; return (A) this;
  }
  public Boolean hasPreserveUnknownFields() {
    return this.preserveUnknownFields != null;
  }
  public String getScope() {
    return this.scope;
  }
  public A withScope(String scope) {
    this.scope=scope; return (A) this;
  }
  public Boolean hasScope() {
    return this.scope != null;
  }
  public A addToVersions(int index,V1CustomResourceDefinitionVersion item) {
    if (this.versions == null) {this.versions = new ArrayList();}
    V1CustomResourceDefinitionVersionBuilder builder = new V1CustomResourceDefinitionVersionBuilder(item);
    if (index < 0 || index >= versions.size()) { _visitables.get("versions").add(builder); versions.add(builder); } else { _visitables.get("versions").add(index, builder); versions.add(index, builder);}
    return (A)this;
  }
  public A setToVersions(int index,V1CustomResourceDefinitionVersion item) {
    if (this.versions == null) {this.versions = new ArrayList();}
    V1CustomResourceDefinitionVersionBuilder builder = new V1CustomResourceDefinitionVersionBuilder(item);
    if (index < 0 || index >= versions.size()) { _visitables.get("versions").add(builder); versions.add(builder); } else { _visitables.get("versions").set(index, builder); versions.set(index, builder);}
    return (A)this;
  }
  public A addToVersions(io.kubernetes.client.openapi.models.V1CustomResourceDefinitionVersion... items) {
    if (this.versions == null) {this.versions = new ArrayList();}
    for (V1CustomResourceDefinitionVersion item : items) {V1CustomResourceDefinitionVersionBuilder builder = new V1CustomResourceDefinitionVersionBuilder(item);_visitables.get("versions").add(builder);this.versions.add(builder);} return (A)this;
  }
  public A addAllToVersions(Collection items) {
    if (this.versions == null) {this.versions = new ArrayList();}
    for (V1CustomResourceDefinitionVersion item : items) {V1CustomResourceDefinitionVersionBuilder builder = new V1CustomResourceDefinitionVersionBuilder(item);_visitables.get("versions").add(builder);this.versions.add(builder);} return (A)this;
  }
  public A removeFromVersions(io.kubernetes.client.openapi.models.V1CustomResourceDefinitionVersion... items) {
    for (V1CustomResourceDefinitionVersion item : items) {V1CustomResourceDefinitionVersionBuilder builder = new V1CustomResourceDefinitionVersionBuilder(item);_visitables.get("versions").remove(builder);if (this.versions != null) {this.versions.remove(builder);}} return (A)this;
  }
  public A removeAllFromVersions(Collection items) {
    for (V1CustomResourceDefinitionVersion item : items) {V1CustomResourceDefinitionVersionBuilder builder = new V1CustomResourceDefinitionVersionBuilder(item);_visitables.get("versions").remove(builder);if (this.versions != null) {this.versions.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromVersions(Predicate predicate) {
    if (versions == null) return (A) this;
    final Iterator each = versions.iterator();
    final List visitables = _visitables.get("versions");
    while (each.hasNext()) {
      V1CustomResourceDefinitionVersionBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildVersions instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getVersions() {
    return versions != null ? build(versions) : null;
  }
  public List buildVersions() {
    return versions != null ? build(versions) : null;
  }
  public V1CustomResourceDefinitionVersion buildVersion(int index) {
    return this.versions.get(index).build();
  }
  public V1CustomResourceDefinitionVersion buildFirstVersion() {
    return this.versions.get(0).build();
  }
  public V1CustomResourceDefinitionVersion buildLastVersion() {
    return this.versions.get(versions.size() - 1).build();
  }
  public V1CustomResourceDefinitionVersion buildMatchingVersion(Predicate predicate) {
    for (V1CustomResourceDefinitionVersionBuilder item: versions) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingVersion(Predicate predicate) {
    for (V1CustomResourceDefinitionVersionBuilder item: versions) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withVersions(List versions) {
    if (this.versions != null) { _visitables.get("versions").clear();}
    if (versions != null) {this.versions = new ArrayList(); for (V1CustomResourceDefinitionVersion item : versions){this.addToVersions(item);}} else { this.versions = null;} return (A) this;
  }
  public A withVersions(io.kubernetes.client.openapi.models.V1CustomResourceDefinitionVersion... versions) {
    if (this.versions != null) {this.versions.clear(); _visitables.remove("versions"); }
    if (versions != null) {for (V1CustomResourceDefinitionVersion item :versions){ this.addToVersions(item);}} return (A) this;
  }
  public Boolean hasVersions() {
    return versions != null && !versions.isEmpty();
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested addNewVersion() {
    return new V1CustomResourceDefinitionSpecFluentImpl.VersionsNestedImpl();
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested addNewVersionLike(V1CustomResourceDefinitionVersion item) {
    return new V1CustomResourceDefinitionSpecFluentImpl.VersionsNestedImpl(-1, item);
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested setNewVersionLike(int index,V1CustomResourceDefinitionVersion item) {
    return new V1CustomResourceDefinitionSpecFluentImpl.VersionsNestedImpl(index, item);
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested editVersion(int index) {
    if (versions.size() <= index) throw new RuntimeException("Can't edit versions. Index exceeds size.");
    return setNewVersionLike(index, buildVersion(index));
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested editFirstVersion() {
    if (versions.size() == 0) throw new RuntimeException("Can't edit first versions. The list is empty.");
    return setNewVersionLike(0, buildVersion(0));
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested editLastVersion() {
    int index = versions.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last versions. The list is empty.");
    return setNewVersionLike(index, buildVersion(index));
  }
  public V1CustomResourceDefinitionSpecFluentImpl.VersionsNested editMatchingVersion(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends V1CustomResourceConversionFluentImpl> implements V1CustomResourceDefinitionSpecFluentImpl.ConversionNested,Nested{
    ConversionNestedImpl(V1CustomResourceConversion item) {
      this.builder = new V1CustomResourceConversionBuilder(this, item);
    }
    ConversionNestedImpl() {
      this.builder = new V1CustomResourceConversionBuilder(this);
    }
    V1CustomResourceConversionBuilder builder;
    public N and() {
      return (N) V1CustomResourceDefinitionSpecFluentImpl.this.withConversion(builder.build());
    }
    public N endConversion() {
      return and();
    }
    
  }
  class NamesNestedImpl extends V1CustomResourceDefinitionNamesFluentImpl> implements V1CustomResourceDefinitionSpecFluentImpl.NamesNested,Nested{
    NamesNestedImpl(V1CustomResourceDefinitionNames item) {
      this.builder = new V1CustomResourceDefinitionNamesBuilder(this, item);
    }
    NamesNestedImpl() {
      this.builder = new V1CustomResourceDefinitionNamesBuilder(this);
    }
    V1CustomResourceDefinitionNamesBuilder builder;
    public N and() {
      return (N) V1CustomResourceDefinitionSpecFluentImpl.this.withNames(builder.build());
    }
    public N endNames() {
      return and();
    }
    
  }
  class VersionsNestedImpl extends V1CustomResourceDefinitionVersionFluentImpl> implements V1CustomResourceDefinitionSpecFluentImpl.VersionsNested,Nested{
    VersionsNestedImpl(int index,V1CustomResourceDefinitionVersion item) {
      this.index = index;
      this.builder = new V1CustomResourceDefinitionVersionBuilder(this, item);
    }
    VersionsNestedImpl() {
      this.index = -1;
      this.builder = new V1CustomResourceDefinitionVersionBuilder(this);
    }
    V1CustomResourceDefinitionVersionBuilder builder;
    int index;
    public N and() {
      return (N) V1CustomResourceDefinitionSpecFluentImpl.this.setToVersions(index,builder.build());
    }
    public N endVersion() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy