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

io.fabric8.tekton.triggers.v1alpha1.GitLabInterceptorFluent Maven / Gradle / Ivy

package io.fabric8.tekton.triggers.v1alpha1;

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

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class GitLabInterceptorFluent> extends BaseFluent{
  public GitLabInterceptorFluent() {
  }
  
  public GitLabInterceptorFluent(GitLabInterceptor instance) {
    this.copyInstance(instance);
  }
  private List eventTypes = new ArrayList();
  private SecretRefBuilder secretRef;
  private Map additionalProperties;
  
  protected void copyInstance(GitLabInterceptor instance) {
    instance = (instance != null ? instance : new GitLabInterceptor());
    if (instance != null) {
          this.withEventTypes(instance.getEventTypes());
          this.withSecretRef(instance.getSecretRef());
          this.withAdditionalProperties(instance.getAdditionalProperties());
        }
  }
  
  public A addToEventTypes(int index,String item) {
    if (this.eventTypes == null) {this.eventTypes = new ArrayList();}
    this.eventTypes.add(index, item);
    return (A)this;
  }
  
  public A setToEventTypes(int index,String item) {
    if (this.eventTypes == null) {this.eventTypes = new ArrayList();}
    this.eventTypes.set(index, item); return (A)this;
  }
  
  public A addToEventTypes(java.lang.String... items) {
    if (this.eventTypes == null) {this.eventTypes = new ArrayList();}
    for (String item : items) {this.eventTypes.add(item);} return (A)this;
  }
  
  public A addAllToEventTypes(Collection items) {
    if (this.eventTypes == null) {this.eventTypes = new ArrayList();}
    for (String item : items) {this.eventTypes.add(item);} return (A)this;
  }
  
  public A removeFromEventTypes(java.lang.String... items) {
    if (this.eventTypes == null) return (A)this;
    for (String item : items) { this.eventTypes.remove(item);} return (A)this;
  }
  
  public A removeAllFromEventTypes(Collection items) {
    if (this.eventTypes == null) return (A)this;
    for (String item : items) { this.eventTypes.remove(item);} return (A)this;
  }
  
  public List getEventTypes() {
    return this.eventTypes;
  }
  
  public String getEventType(int index) {
    return this.eventTypes.get(index);
  }
  
  public String getFirstEventType() {
    return this.eventTypes.get(0);
  }
  
  public String getLastEventType() {
    return this.eventTypes.get(eventTypes.size() - 1);
  }
  
  public String getMatchingEventType(Predicate predicate) {
      for (String item : eventTypes) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingEventType(Predicate predicate) {
      for (String item : eventTypes) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withEventTypes(List eventTypes) {
    if (eventTypes != null) {
        this.eventTypes = new ArrayList();
        for (String item : eventTypes) {
          this.addToEventTypes(item);
        }
    } else {
      this.eventTypes = null;
    }
    return (A) this;
  }
  
  public A withEventTypes(java.lang.String... eventTypes) {
    if (this.eventTypes != null) {
        this.eventTypes.clear();
        _visitables.remove("eventTypes");
    }
    if (eventTypes != null) {
      for (String item : eventTypes) {
        this.addToEventTypes(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasEventTypes() {
    return this.eventTypes != null && !this.eventTypes.isEmpty();
  }
  
  public SecretRef buildSecretRef() {
    return this.secretRef != null ? this.secretRef.build() : null;
  }
  
  public A withSecretRef(SecretRef secretRef) {
    this._visitables.remove("secretRef");
    if (secretRef != null) {
        this.secretRef = new SecretRefBuilder(secretRef);
        this._visitables.get("secretRef").add(this.secretRef);
    } else {
        this.secretRef = null;
        this._visitables.get("secretRef").remove(this.secretRef);
    }
    return (A) this;
  }
  
  public boolean hasSecretRef() {
    return this.secretRef != null;
  }
  
  public A withNewSecretRef(String secretKey,String secretName) {
    return (A)withSecretRef(new SecretRef(secretKey, secretName));
  }
  
  public SecretRefNested withNewSecretRef() {
    return new SecretRefNested(null);
  }
  
  public SecretRefNested withNewSecretRefLike(SecretRef item) {
    return new SecretRefNested(item);
  }
  
  public SecretRefNested editSecretRef() {
    return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(null));
  }
  
  public SecretRefNested editOrNewSecretRef() {
    return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(new SecretRefBuilder().build()));
  }
  
  public SecretRefNested editOrNewSecretRefLike(SecretRef item) {
    return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(item));
  }
  
  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;
    GitLabInterceptorFluent that = (GitLabInterceptorFluent) o;
    if (!java.util.Objects.equals(eventTypes, that.eventTypes)) return false;
    if (!java.util.Objects.equals(secretRef, that.secretRef)) return false;
    if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(eventTypes,  secretRef,  additionalProperties,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (eventTypes != null && !eventTypes.isEmpty()) { sb.append("eventTypes:"); sb.append(eventTypes + ","); }
    if (secretRef != null) { sb.append("secretRef:"); sb.append(secretRef + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  public class SecretRefNested extends SecretRefFluent> implements Nested{
    SecretRefNested(SecretRef item) {
      this.builder = new SecretRefBuilder(this, item);
    }
    SecretRefBuilder builder;
    
    public N and() {
      return (N) GitLabInterceptorFluent.this.withSecretRef(builder.build());
    }
    
    public N endSecretRef() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy