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

io.kubernetes.client.openapi.models.V1APIGroupFluentImpl 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.lang.Integer;
import java.util.Collection;
import java.lang.Object;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class V1APIGroupFluentImpl> extends BaseFluent implements V1APIGroupFluent{
  public V1APIGroupFluentImpl() {
  }
  public V1APIGroupFluentImpl(V1APIGroup instance) {
    this.withApiVersion(instance.getApiVersion());

    this.withKind(instance.getKind());

    this.withName(instance.getName());

    this.withPreferredVersion(instance.getPreferredVersion());

    this.withServerAddressByClientCIDRs(instance.getServerAddressByClientCIDRs());

    this.withVersions(instance.getVersions());

  }
  private String apiVersion;
  private String kind;
  private String name;
  private V1GroupVersionForDiscoveryBuilder preferredVersion;
  private ArrayList serverAddressByClientCIDRs;
  private ArrayList versions;
  public String getApiVersion() {
    return this.apiVersion;
  }
  public A withApiVersion(String apiVersion) {
    this.apiVersion=apiVersion; return (A) this;
  }
  public Boolean hasApiVersion() {
    return this.apiVersion != null;
  }
  public String getKind() {
    return this.kind;
  }
  public A withKind(String kind) {
    this.kind=kind; return (A) this;
  }
  public Boolean hasKind() {
    return this.kind != null;
  }
  public String getName() {
    return this.name;
  }
  public A withName(String name) {
    this.name=name; return (A) this;
  }
  public Boolean hasName() {
    return this.name != null;
  }
  
  /**
   * This method has been deprecated, please use method buildPreferredVersion instead.
   * @return The buildable object.
   */
  @Deprecated
  public V1GroupVersionForDiscovery getPreferredVersion() {
    return this.preferredVersion!=null ?this.preferredVersion.build():null;
  }
  public V1GroupVersionForDiscovery buildPreferredVersion() {
    return this.preferredVersion!=null ?this.preferredVersion.build():null;
  }
  public A withPreferredVersion(V1GroupVersionForDiscovery preferredVersion) {
    _visitables.get("preferredVersion").remove(this.preferredVersion);
    if (preferredVersion!=null){ this.preferredVersion= new V1GroupVersionForDiscoveryBuilder(preferredVersion); _visitables.get("preferredVersion").add(this.preferredVersion);} else { this.preferredVersion = null; _visitables.get("preferredVersion").remove(this.preferredVersion); } return (A) this;
  }
  public Boolean hasPreferredVersion() {
    return this.preferredVersion != null;
  }
  public V1APIGroupFluent.PreferredVersionNested withNewPreferredVersion() {
    return new V1APIGroupFluentImpl.PreferredVersionNestedImpl();
  }
  public V1APIGroupFluent.PreferredVersionNested withNewPreferredVersionLike(V1GroupVersionForDiscovery item) {
    return new V1APIGroupFluentImpl.PreferredVersionNestedImpl(item);
  }
  public V1APIGroupFluent.PreferredVersionNested editPreferredVersion() {
    return withNewPreferredVersionLike(getPreferredVersion());
  }
  public V1APIGroupFluent.PreferredVersionNested editOrNewPreferredVersion() {
    return withNewPreferredVersionLike(getPreferredVersion() != null ? getPreferredVersion(): new V1GroupVersionForDiscoveryBuilder().build());
  }
  public V1APIGroupFluent.PreferredVersionNested editOrNewPreferredVersionLike(V1GroupVersionForDiscovery item) {
    return withNewPreferredVersionLike(getPreferredVersion() != null ? getPreferredVersion(): item);
  }
  public A addToServerAddressByClientCIDRs(Integer index,V1ServerAddressByClientCIDR item) {
    if (this.serverAddressByClientCIDRs == null) {this.serverAddressByClientCIDRs = new ArrayList();}
    V1ServerAddressByClientCIDRBuilder builder = new V1ServerAddressByClientCIDRBuilder(item);_visitables.get("serverAddressByClientCIDRs").add(index >= 0 ? index : _visitables.get("serverAddressByClientCIDRs").size(), builder);this.serverAddressByClientCIDRs.add(index >= 0 ? index : serverAddressByClientCIDRs.size(), builder); return (A)this;
  }
  public A setToServerAddressByClientCIDRs(Integer index,V1ServerAddressByClientCIDR item) {
    if (this.serverAddressByClientCIDRs == null) {this.serverAddressByClientCIDRs = new ArrayList();}
    V1ServerAddressByClientCIDRBuilder builder = new V1ServerAddressByClientCIDRBuilder(item);
    if (index < 0 || index >= _visitables.get("serverAddressByClientCIDRs").size()) { _visitables.get("serverAddressByClientCIDRs").add(builder); } else { _visitables.get("serverAddressByClientCIDRs").set(index, builder);}
    if (index < 0 || index >= serverAddressByClientCIDRs.size()) { serverAddressByClientCIDRs.add(builder); } else { serverAddressByClientCIDRs.set(index, builder);}
     return (A)this;
  }
  public A addToServerAddressByClientCIDRs(io.kubernetes.client.openapi.models.V1ServerAddressByClientCIDR... items) {
    if (this.serverAddressByClientCIDRs == null) {this.serverAddressByClientCIDRs = new ArrayList();}
    for (V1ServerAddressByClientCIDR item : items) {V1ServerAddressByClientCIDRBuilder builder = new V1ServerAddressByClientCIDRBuilder(item);_visitables.get("serverAddressByClientCIDRs").add(builder);this.serverAddressByClientCIDRs.add(builder);} return (A)this;
  }
  public A addAllToServerAddressByClientCIDRs(Collection items) {
    if (this.serverAddressByClientCIDRs == null) {this.serverAddressByClientCIDRs = new ArrayList();}
    for (V1ServerAddressByClientCIDR item : items) {V1ServerAddressByClientCIDRBuilder builder = new V1ServerAddressByClientCIDRBuilder(item);_visitables.get("serverAddressByClientCIDRs").add(builder);this.serverAddressByClientCIDRs.add(builder);} return (A)this;
  }
  public A removeFromServerAddressByClientCIDRs(io.kubernetes.client.openapi.models.V1ServerAddressByClientCIDR... items) {
    for (V1ServerAddressByClientCIDR item : items) {V1ServerAddressByClientCIDRBuilder builder = new V1ServerAddressByClientCIDRBuilder(item);_visitables.get("serverAddressByClientCIDRs").remove(builder);if (this.serverAddressByClientCIDRs != null) {this.serverAddressByClientCIDRs.remove(builder);}} return (A)this;
  }
  public A removeAllFromServerAddressByClientCIDRs(Collection items) {
    for (V1ServerAddressByClientCIDR item : items) {V1ServerAddressByClientCIDRBuilder builder = new V1ServerAddressByClientCIDRBuilder(item);_visitables.get("serverAddressByClientCIDRs").remove(builder);if (this.serverAddressByClientCIDRs != null) {this.serverAddressByClientCIDRs.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromServerAddressByClientCIDRs(Predicate predicate) {
    if (serverAddressByClientCIDRs == null) return (A) this;
    final Iterator each = serverAddressByClientCIDRs.iterator();
    final List visitables = _visitables.get("serverAddressByClientCIDRs");
    while (each.hasNext()) {
      V1ServerAddressByClientCIDRBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildServerAddressByClientCIDRs instead.
   * @return The buildable object.
   */
  @Deprecated
  public List getServerAddressByClientCIDRs() {
    return serverAddressByClientCIDRs != null ? build(serverAddressByClientCIDRs) : null;
  }
  public List buildServerAddressByClientCIDRs() {
    return serverAddressByClientCIDRs != null ? build(serverAddressByClientCIDRs) : null;
  }
  public V1ServerAddressByClientCIDR buildServerAddressByClientCIDR(Integer index) {
    return this.serverAddressByClientCIDRs.get(index).build();
  }
  public V1ServerAddressByClientCIDR buildFirstServerAddressByClientCIDR() {
    return this.serverAddressByClientCIDRs.get(0).build();
  }
  public V1ServerAddressByClientCIDR buildLastServerAddressByClientCIDR() {
    return this.serverAddressByClientCIDRs.get(serverAddressByClientCIDRs.size() - 1).build();
  }
  public V1ServerAddressByClientCIDR buildMatchingServerAddressByClientCIDR(Predicate predicate) {
    for (V1ServerAddressByClientCIDRBuilder item: serverAddressByClientCIDRs) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingServerAddressByClientCIDR(Predicate predicate) {
    for (V1ServerAddressByClientCIDRBuilder item: serverAddressByClientCIDRs) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withServerAddressByClientCIDRs(List serverAddressByClientCIDRs) {
    if (this.serverAddressByClientCIDRs != null) { _visitables.get("serverAddressByClientCIDRs").removeAll(this.serverAddressByClientCIDRs);}
    if (serverAddressByClientCIDRs != null) {this.serverAddressByClientCIDRs = new ArrayList(); for (V1ServerAddressByClientCIDR item : serverAddressByClientCIDRs){this.addToServerAddressByClientCIDRs(item);}} else { this.serverAddressByClientCIDRs = null;} return (A) this;
  }
  public A withServerAddressByClientCIDRs(io.kubernetes.client.openapi.models.V1ServerAddressByClientCIDR... serverAddressByClientCIDRs) {
    if (this.serverAddressByClientCIDRs != null) {this.serverAddressByClientCIDRs.clear();}
    if (serverAddressByClientCIDRs != null) {for (V1ServerAddressByClientCIDR item :serverAddressByClientCIDRs){ this.addToServerAddressByClientCIDRs(item);}} return (A) this;
  }
  public Boolean hasServerAddressByClientCIDRs() {
    return serverAddressByClientCIDRs != null && !serverAddressByClientCIDRs.isEmpty();
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested addNewServerAddressByClientCIDR() {
    return new V1APIGroupFluentImpl.ServerAddressByClientCIDRsNestedImpl();
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested addNewServerAddressByClientCIDRLike(V1ServerAddressByClientCIDR item) {
    return new V1APIGroupFluentImpl.ServerAddressByClientCIDRsNestedImpl(-1, item);
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested setNewServerAddressByClientCIDRLike(Integer index,V1ServerAddressByClientCIDR item) {
    return new V1APIGroupFluentImpl.ServerAddressByClientCIDRsNestedImpl(index, item);
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested editServerAddressByClientCIDR(Integer index) {
    if (serverAddressByClientCIDRs.size() <= index) throw new RuntimeException("Can't edit serverAddressByClientCIDRs. Index exceeds size.");
    return setNewServerAddressByClientCIDRLike(index, buildServerAddressByClientCIDR(index));
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested editFirstServerAddressByClientCIDR() {
    if (serverAddressByClientCIDRs.size() == 0) throw new RuntimeException("Can't edit first serverAddressByClientCIDRs. The list is empty.");
    return setNewServerAddressByClientCIDRLike(0, buildServerAddressByClientCIDR(0));
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested editLastServerAddressByClientCIDR() {
    int index = serverAddressByClientCIDRs.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last serverAddressByClientCIDRs. The list is empty.");
    return setNewServerAddressByClientCIDRLike(index, buildServerAddressByClientCIDR(index));
  }
  public V1APIGroupFluent.ServerAddressByClientCIDRsNested editMatchingServerAddressByClientCIDR(Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    V1GroupVersionForDiscoveryBuilder builder = new V1GroupVersionForDiscoveryBuilder(item);_visitables.get("versions").add(index >= 0 ? index : _visitables.get("versions").size(), builder);this.versions.add(index >= 0 ? index : versions.size(), builder); return (A)this;
  }
  public A setToVersions(Integer index,V1GroupVersionForDiscovery item) {
    if (this.versions == null) {this.versions = new ArrayList();}
    V1GroupVersionForDiscoveryBuilder builder = new V1GroupVersionForDiscoveryBuilder(item);
    if (index < 0 || index >= _visitables.get("versions").size()) { _visitables.get("versions").add(builder); } else { _visitables.get("versions").set(index, builder);}
    if (index < 0 || index >= versions.size()) { versions.add(builder); } else { versions.set(index, builder);}
     return (A)this;
  }
  public A addToVersions(io.kubernetes.client.openapi.models.V1GroupVersionForDiscovery... items) {
    if (this.versions == null) {this.versions = new ArrayList();}
    for (V1GroupVersionForDiscovery item : items) {V1GroupVersionForDiscoveryBuilder builder = new V1GroupVersionForDiscoveryBuilder(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 (V1GroupVersionForDiscovery item : items) {V1GroupVersionForDiscoveryBuilder builder = new V1GroupVersionForDiscoveryBuilder(item);_visitables.get("versions").add(builder);this.versions.add(builder);} return (A)this;
  }
  public A removeFromVersions(io.kubernetes.client.openapi.models.V1GroupVersionForDiscovery... items) {
    for (V1GroupVersionForDiscovery item : items) {V1GroupVersionForDiscoveryBuilder builder = new V1GroupVersionForDiscoveryBuilder(item);_visitables.get("versions").remove(builder);if (this.versions != null) {this.versions.remove(builder);}} return (A)this;
  }
  public A removeAllFromVersions(Collection items) {
    for (V1GroupVersionForDiscovery item : items) {V1GroupVersionForDiscoveryBuilder builder = new V1GroupVersionForDiscoveryBuilder(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()) {
      V1GroupVersionForDiscoveryBuilder 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 V1GroupVersionForDiscovery buildVersion(Integer index) {
    return this.versions.get(index).build();
  }
  public V1GroupVersionForDiscovery buildFirstVersion() {
    return this.versions.get(0).build();
  }
  public V1GroupVersionForDiscovery buildLastVersion() {
    return this.versions.get(versions.size() - 1).build();
  }
  public V1GroupVersionForDiscovery buildMatchingVersion(Predicate predicate) {
    for (V1GroupVersionForDiscoveryBuilder item: versions) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public Boolean hasMatchingVersion(Predicate predicate) {
    for (V1GroupVersionForDiscoveryBuilder item: versions) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withVersions(List versions) {
    if (this.versions != null) { _visitables.get("versions").removeAll(this.versions);}
    if (versions != null) {this.versions = new ArrayList(); for (V1GroupVersionForDiscovery item : versions){this.addToVersions(item);}} else { this.versions = null;} return (A) this;
  }
  public A withVersions(io.kubernetes.client.openapi.models.V1GroupVersionForDiscovery... versions) {
    if (this.versions != null) {this.versions.clear();}
    if (versions != null) {for (V1GroupVersionForDiscovery item :versions){ this.addToVersions(item);}} return (A) this;
  }
  public Boolean hasVersions() {
    return versions != null && !versions.isEmpty();
  }
  public V1APIGroupFluent.VersionsNested addNewVersion() {
    return new V1APIGroupFluentImpl.VersionsNestedImpl();
  }
  public V1APIGroupFluent.VersionsNested addNewVersionLike(V1GroupVersionForDiscovery item) {
    return new V1APIGroupFluentImpl.VersionsNestedImpl(-1, item);
  }
  public V1APIGroupFluent.VersionsNested setNewVersionLike(Integer index,V1GroupVersionForDiscovery item) {
    return new V1APIGroupFluentImpl.VersionsNestedImpl(index, item);
  }
  public V1APIGroupFluent.VersionsNested editVersion(Integer index) {
    if (versions.size() <= index) throw new RuntimeException("Can't edit versions. Index exceeds size.");
    return setNewVersionLike(index, buildVersion(index));
  }
  public V1APIGroupFluent.VersionsNested editFirstVersion() {
    if (versions.size() == 0) throw new RuntimeException("Can't edit first versions. The list is empty.");
    return setNewVersionLike(0, buildVersion(0));
  }
  public V1APIGroupFluent.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 V1APIGroupFluent.VersionsNested editMatchingVersion(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends V1GroupVersionForDiscoveryFluentImpl> implements V1APIGroupFluent.PreferredVersionNested,Nested{
    PreferredVersionNestedImpl(V1GroupVersionForDiscovery item) {
      this.builder = new V1GroupVersionForDiscoveryBuilder(this, item);
    }
    PreferredVersionNestedImpl() {
      this.builder = new V1GroupVersionForDiscoveryBuilder(this);
    }
    V1GroupVersionForDiscoveryBuilder builder;
    public N and() {
      return (N) V1APIGroupFluentImpl.this.withPreferredVersion(builder.build());
    }
    public N endPreferredVersion() {
      return and();
    }
    
  }
  class ServerAddressByClientCIDRsNestedImpl extends V1ServerAddressByClientCIDRFluentImpl> implements V1APIGroupFluent.ServerAddressByClientCIDRsNested,Nested{
    ServerAddressByClientCIDRsNestedImpl(Integer index,V1ServerAddressByClientCIDR item) {
      this.index = index;
      this.builder = new V1ServerAddressByClientCIDRBuilder(this, item);
    }
    ServerAddressByClientCIDRsNestedImpl() {
      this.index = -1;
      this.builder = new V1ServerAddressByClientCIDRBuilder(this);
    }
    V1ServerAddressByClientCIDRBuilder builder;
    Integer index;
    public N and() {
      return (N) V1APIGroupFluentImpl.this.setToServerAddressByClientCIDRs(index,builder.build());
    }
    public N endServerAddressByClientCIDR() {
      return and();
    }
    
  }
  class VersionsNestedImpl extends V1GroupVersionForDiscoveryFluentImpl> implements V1APIGroupFluent.VersionsNested,Nested{
    VersionsNestedImpl(Integer index,V1GroupVersionForDiscovery item) {
      this.index = index;
      this.builder = new V1GroupVersionForDiscoveryBuilder(this, item);
    }
    VersionsNestedImpl() {
      this.index = -1;
      this.builder = new V1GroupVersionForDiscoveryBuilder(this);
    }
    V1GroupVersionForDiscoveryBuilder builder;
    Integer index;
    public N and() {
      return (N) V1APIGroupFluentImpl.this.setToVersions(index,builder.build());
    }
    public N endVersion() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy