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

io.fabric8.knative.eventing.v1alpha1.EventPolicySelectorFluent Maven / Gradle / Ivy

The newest version!
package io.fabric8.knative.eventing.v1alpha1;

import java.lang.SuppressWarnings;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import io.fabric8.kubernetes.api.model.LabelSelectorRequirement;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class EventPolicySelectorFluent> extends BaseFluent{
  public EventPolicySelectorFluent() {
  }
  
  public EventPolicySelectorFluent(EventPolicySelector instance) {
    this.copyInstance(instance);
  }
  private String apiVersion;
  private String kind;
  private List matchExpressions = new ArrayList();
  private Map matchLabels;
  private Map additionalProperties;
  
  protected void copyInstance(EventPolicySelector instance) {
    instance = (instance != null ? instance : new EventPolicySelector());
    if (instance != null) {
          this.withApiVersion(instance.getApiVersion());
          this.withKind(instance.getKind());
          this.withMatchExpressions(instance.getMatchExpressions());
          this.withMatchLabels(instance.getMatchLabels());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  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 A addToMatchExpressions(int index,LabelSelectorRequirement item) {
    if (this.matchExpressions == null) {this.matchExpressions = new ArrayList();}
    this.matchExpressions.add(index, item);
    return (A)this;
  }
  
  public A setToMatchExpressions(int index,LabelSelectorRequirement item) {
    if (this.matchExpressions == null) {this.matchExpressions = new ArrayList();}
    this.matchExpressions.set(index, item); return (A)this;
  }
  
  public A addToMatchExpressions(io.fabric8.kubernetes.api.model.LabelSelectorRequirement... items) {
    if (this.matchExpressions == null) {this.matchExpressions = new ArrayList();}
    for (LabelSelectorRequirement item : items) {this.matchExpressions.add(item);} return (A)this;
  }
  
  public A addAllToMatchExpressions(Collection items) {
    if (this.matchExpressions == null) {this.matchExpressions = new ArrayList();}
    for (LabelSelectorRequirement item : items) {this.matchExpressions.add(item);} return (A)this;
  }
  
  public A removeFromMatchExpressions(io.fabric8.kubernetes.api.model.LabelSelectorRequirement... items) {
    if (this.matchExpressions == null) return (A)this;
    for (LabelSelectorRequirement item : items) { this.matchExpressions.remove(item);} return (A)this;
  }
  
  public A removeAllFromMatchExpressions(Collection items) {
    if (this.matchExpressions == null) return (A)this;
    for (LabelSelectorRequirement item : items) { this.matchExpressions.remove(item);} return (A)this;
  }
  
  public List getMatchExpressions() {
    return this.matchExpressions;
  }
  
  public LabelSelectorRequirement getMatchExpression(int index) {
    return this.matchExpressions.get(index);
  }
  
  public LabelSelectorRequirement getFirstMatchExpression() {
    return this.matchExpressions.get(0);
  }
  
  public LabelSelectorRequirement getLastMatchExpression() {
    return this.matchExpressions.get(matchExpressions.size() - 1);
  }
  
  public LabelSelectorRequirement getMatchingMatchExpression(Predicate predicate) {
      for (LabelSelectorRequirement item : matchExpressions) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingMatchExpression(Predicate predicate) {
      for (LabelSelectorRequirement item : matchExpressions) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withMatchExpressions(List matchExpressions) {
    if (matchExpressions != null) {
        this.matchExpressions = new ArrayList();
        for (LabelSelectorRequirement item : matchExpressions) {
          this.addToMatchExpressions(item);
        }
    } else {
      this.matchExpressions = null;
    }
    return (A) this;
  }
  
  public A withMatchExpressions(io.fabric8.kubernetes.api.model.LabelSelectorRequirement... matchExpressions) {
    if (this.matchExpressions != null) {
        this.matchExpressions.clear();
        _visitables.remove("matchExpressions");
    }
    if (matchExpressions != null) {
      for (LabelSelectorRequirement item : matchExpressions) {
        this.addToMatchExpressions(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasMatchExpressions() {
    return this.matchExpressions != null && !this.matchExpressions.isEmpty();
  }
  
  public A addToMatchLabels(String key,String value) {
    if(this.matchLabels == null && key != null && value != null) { this.matchLabels = new LinkedHashMap(); }
    if(key != null && value != null) {this.matchLabels.put(key, value);} return (A)this;
  }
  
  public A addToMatchLabels(Map map) {
    if(this.matchLabels == null && map != null) { this.matchLabels = new LinkedHashMap(); }
    if(map != null) { this.matchLabels.putAll(map);} return (A)this;
  }
  
  public A removeFromMatchLabels(String key) {
    if(this.matchLabels == null) { return (A) this; }
    if(key != null && this.matchLabels != null) {this.matchLabels.remove(key);} return (A)this;
  }
  
  public A removeFromMatchLabels(Map map) {
    if(this.matchLabels == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.matchLabels != null){this.matchLabels.remove(key);}}} return (A)this;
  }
  
  public Map getMatchLabels() {
    return this.matchLabels;
  }
  
  public A withMatchLabels(Map matchLabels) {
    if (matchLabels == null) {
      this.matchLabels = null;
    } else {
      this.matchLabels = new LinkedHashMap(matchLabels);
    }
    return (A) this;
  }
  
  public boolean hasMatchLabels() {
    return this.matchLabels != null;
  }
  
  public A addToAdditionalProperties(String key,Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  
  public A addToAdditionalProperties(Map map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  
  public A removeFromAdditionalProperties(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(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 Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  
  public A withAdditionalProperties(Map additionalProperties) {
    if (additionalProperties == null) {
      this.additionalProperties = null;
    } else {
      this.additionalProperties = new LinkedHashMap(additionalProperties);
    }
    return (A) this;
  }
  
  public boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    EventPolicySelectorFluent that = (EventPolicySelectorFluent) o;
    if (!java.util.Objects.equals(apiVersion, that.apiVersion)) return false;
    if (!java.util.Objects.equals(kind, that.kind)) return false;
    if (!java.util.Objects.equals(matchExpressions, that.matchExpressions)) return false;
    if (!java.util.Objects.equals(matchLabels, that.matchLabels)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(apiVersion,  kind,  matchExpressions,  matchLabels,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (apiVersion != null) { sb.append("apiVersion:"); sb.append(apiVersion + ","); }
    if (kind != null) { sb.append("kind:"); sb.append(kind + ","); }
    if (matchExpressions != null && !matchExpressions.isEmpty()) { sb.append("matchExpressions:"); sb.append(matchExpressions + ","); }
    if (matchLabels != null && !matchLabels.isEmpty()) { sb.append("matchLabels:"); sb.append(matchLabels + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy