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

io.fabric8.kubernetes.api.model.PodAffinityTermFluentImpl Maven / Gradle / Ivy

package io.fabric8.kubernetes.api.model;

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.Integer;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
import java.util.Map;

 /**
  * Generated
  */
public class PodAffinityTermFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.PodAffinityTermFluent{
  public PodAffinityTermFluentImpl() {
  }
  public PodAffinityTermFluentImpl(io.fabric8.kubernetes.api.model.PodAffinityTerm instance) {
    this.withLabelSelector(instance.getLabelSelector()); 
    this.withNamespaceSelector(instance.getNamespaceSelector()); 
    this.withNamespaces(instance.getNamespaces()); 
    this.withTopologyKey(instance.getTopologyKey()); 
    this.withAdditionalProperties(instance.getAdditionalProperties());

  }
  private io.fabric8.kubernetes.api.model.LabelSelectorBuilder labelSelector;
  private io.fabric8.kubernetes.api.model.LabelSelectorBuilder namespaceSelector;
  private java.util.List namespaces = new java.util.ArrayList();
  private java.lang.String topologyKey;
  private java.util.Map additionalProperties;
  
  /**
   * This method has been deprecated, please use method buildLabelSelector instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public io.fabric8.kubernetes.api.model.LabelSelector getLabelSelector() {
    return this.labelSelector!=null?this.labelSelector.build():null;
  }
  public io.fabric8.kubernetes.api.model.LabelSelector buildLabelSelector() {
    return this.labelSelector!=null?this.labelSelector.build():null;
  }
  public A withLabelSelector(io.fabric8.kubernetes.api.model.LabelSelector labelSelector) {
    _visitables.get("labelSelector").remove(this.labelSelector);
    if (labelSelector!=null){ this.labelSelector= new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(labelSelector); _visitables.get("labelSelector").add(this.labelSelector);} return (A) this;
  }
  public java.lang.Boolean hasLabelSelector() {
    return this.labelSelector != null;
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.LabelSelectorNested withNewLabelSelector() {
    return new io.fabric8.kubernetes.api.model.PodAffinityTermFluentImpl.LabelSelectorNestedImpl();
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.LabelSelectorNested withNewLabelSelectorLike(io.fabric8.kubernetes.api.model.LabelSelector item) {
    return new io.fabric8.kubernetes.api.model.PodAffinityTermFluentImpl.LabelSelectorNestedImpl(item);
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.LabelSelectorNested editLabelSelector() {
    return withNewLabelSelectorLike(getLabelSelector());
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.LabelSelectorNested editOrNewLabelSelector() {
    return withNewLabelSelectorLike(getLabelSelector() != null ? getLabelSelector(): new io.fabric8.kubernetes.api.model.LabelSelectorBuilder().build());
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.LabelSelectorNested editOrNewLabelSelectorLike(io.fabric8.kubernetes.api.model.LabelSelector item) {
    return withNewLabelSelectorLike(getLabelSelector() != null ? getLabelSelector(): item);
  }
  
  /**
   * This method has been deprecated, please use method buildNamespaceSelector instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public io.fabric8.kubernetes.api.model.LabelSelector getNamespaceSelector() {
    return this.namespaceSelector!=null?this.namespaceSelector.build():null;
  }
  public io.fabric8.kubernetes.api.model.LabelSelector buildNamespaceSelector() {
    return this.namespaceSelector!=null?this.namespaceSelector.build():null;
  }
  public A withNamespaceSelector(io.fabric8.kubernetes.api.model.LabelSelector namespaceSelector) {
    _visitables.get("namespaceSelector").remove(this.namespaceSelector);
    if (namespaceSelector!=null){ this.namespaceSelector= new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(namespaceSelector); _visitables.get("namespaceSelector").add(this.namespaceSelector);} return (A) this;
  }
  public java.lang.Boolean hasNamespaceSelector() {
    return this.namespaceSelector != null;
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.NamespaceSelectorNested withNewNamespaceSelector() {
    return new io.fabric8.kubernetes.api.model.PodAffinityTermFluentImpl.NamespaceSelectorNestedImpl();
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.NamespaceSelectorNested withNewNamespaceSelectorLike(io.fabric8.kubernetes.api.model.LabelSelector item) {
    return new io.fabric8.kubernetes.api.model.PodAffinityTermFluentImpl.NamespaceSelectorNestedImpl(item);
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.NamespaceSelectorNested editNamespaceSelector() {
    return withNewNamespaceSelectorLike(getNamespaceSelector());
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.NamespaceSelectorNested editOrNewNamespaceSelector() {
    return withNewNamespaceSelectorLike(getNamespaceSelector() != null ? getNamespaceSelector(): new io.fabric8.kubernetes.api.model.LabelSelectorBuilder().build());
  }
  public io.fabric8.kubernetes.api.model.PodAffinityTermFluent.NamespaceSelectorNested editOrNewNamespaceSelectorLike(io.fabric8.kubernetes.api.model.LabelSelector item) {
    return withNewNamespaceSelectorLike(getNamespaceSelector() != null ? getNamespaceSelector(): item);
  }
  public A addToNamespaces(java.lang.Integer index,java.lang.String item) {
    if (this.namespaces == null) {this.namespaces = new java.util.ArrayList();}
    this.namespaces.add(index, item);
    return (A)this;
  }
  public A setToNamespaces(java.lang.Integer index,java.lang.String item) {
    if (this.namespaces == null) {this.namespaces = new java.util.ArrayList();}
    this.namespaces.set(index, item); return (A)this;
  }
  public A addToNamespaces(java.lang.String... items) {
    if (this.namespaces == null) {this.namespaces = new java.util.ArrayList();}
    for (java.lang.String item : items) {this.namespaces.add(item);} return (A)this;
  }
  public A addAllToNamespaces(java.util.Collection items) {
    if (this.namespaces == null) {this.namespaces = new java.util.ArrayList();}
    for (java.lang.String item : items) {this.namespaces.add(item);} return (A)this;
  }
  public A removeFromNamespaces(java.lang.String... items) {
    for (java.lang.String item : items) {if (this.namespaces!= null){ this.namespaces.remove(item);}} return (A)this;
  }
  public A removeAllFromNamespaces(java.util.Collection items) {
    for (java.lang.String item : items) {if (this.namespaces!= null){ this.namespaces.remove(item);}} return (A)this;
  }
  public java.util.List getNamespaces() {
    return this.namespaces;
  }
  public java.lang.String getNamespace(java.lang.Integer index) {
    return this.namespaces.get(index);
  }
  public java.lang.String getFirstNamespace() {
    return this.namespaces.get(0);
  }
  public java.lang.String getLastNamespace() {
    return this.namespaces.get(namespaces.size() - 1);
  }
  public java.lang.String getMatchingNamespace(java.util.function.Predicate predicate) {
    for (java.lang.String item: namespaces) { if(predicate.test(item)){ return item;} } return null;
  }
  public java.lang.Boolean hasMatchingNamespace(java.util.function.Predicate predicate) {
    for (java.lang.String item: namespaces) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withNamespaces(java.util.List namespaces) {
    if (namespaces != null) {this.namespaces = new java.util.ArrayList(); for (java.lang.String item : namespaces){this.addToNamespaces(item);}} else { this.namespaces = null;} return (A) this;
  }
  public A withNamespaces(java.lang.String... namespaces) {
    if (this.namespaces != null) {this.namespaces.clear();}
    if (namespaces != null) {for (java.lang.String item :namespaces){ this.addToNamespaces(item);}} return (A) this;
  }
  public java.lang.Boolean hasNamespaces() {
    return namespaces != null && !namespaces.isEmpty();
  }
  public A addNewNamespace(java.lang.String arg0) {
    return (A)addToNamespaces(new String(arg0));
  }
  public java.lang.String getTopologyKey() {
    return this.topologyKey;
  }
  public A withTopologyKey(java.lang.String topologyKey) {
    this.topologyKey=topologyKey; return (A) this;
  }
  public java.lang.Boolean hasTopologyKey() {
    return this.topologyKey != null;
  }
  
  /**
   * Method is deprecated. use withTopologyKey instead.
   */
  @java.lang.Deprecated
  public A withNewTopologyKey(java.lang.String arg0) {
    return (A)withTopologyKey(new String(arg0));
  }
  public A addToAdditionalProperties(java.lang.String key,java.lang.Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new java.util.LinkedHashMap(); }
    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;
    PodAffinityTermFluentImpl that = (PodAffinityTermFluentImpl) o;
    if (labelSelector != null ? !labelSelector.equals(that.labelSelector) :that.labelSelector != null) return false;
    if (namespaceSelector != null ? !namespaceSelector.equals(that.namespaceSelector) :that.namespaceSelector != null) return false;
    if (namespaces != null ? !namespaces.equals(that.namespaces) :that.namespaces != null) return false;
    if (topologyKey != null ? !topologyKey.equals(that.topologyKey) :that.topologyKey != 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(labelSelector,  namespaceSelector,  namespaces,  topologyKey,  additionalProperties,  super.hashCode());
  }
  public class LabelSelectorNestedImpl extends io.fabric8.kubernetes.api.model.LabelSelectorFluentImpl> implements io.fabric8.kubernetes.api.model.PodAffinityTermFluent.LabelSelectorNested,io.fabric8.kubernetes.api.builder.Nested{
    LabelSelectorNestedImpl(io.fabric8.kubernetes.api.model.LabelSelector item) {
      this.builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(this, item);
    }
    LabelSelectorNestedImpl() {
      this.builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(this);
    }
    io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder;
    public N and() {
      return (N) PodAffinityTermFluentImpl.this.withLabelSelector(builder.build());
    }
    public N endLabelSelector() {
      return and();
    }
    
  }
  public class NamespaceSelectorNestedImpl extends io.fabric8.kubernetes.api.model.LabelSelectorFluentImpl> implements io.fabric8.kubernetes.api.model.PodAffinityTermFluent.NamespaceSelectorNested,io.fabric8.kubernetes.api.builder.Nested{
    NamespaceSelectorNestedImpl(io.fabric8.kubernetes.api.model.LabelSelector item) {
      this.builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(this, item);
    }
    NamespaceSelectorNestedImpl() {
      this.builder = new io.fabric8.kubernetes.api.model.LabelSelectorBuilder(this);
    }
    io.fabric8.kubernetes.api.model.LabelSelectorBuilder builder;
    public N and() {
      return (N) PodAffinityTermFluentImpl.this.withNamespaceSelector(builder.build());
    }
    public N endNamespaceSelector() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy