io.fabric8.tekton.triggers.v1alpha1.WebhookInterceptorFluent 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.model.ObjectReference;
import io.fabric8.kubernetes.api.model.ObjectReferenceFluent;
import io.fabric8.kubernetes.api.model.ObjectReferenceBuilder;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import io.fabric8.tekton.pipeline.v1beta1.Param;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class WebhookInterceptorFluent> extends BaseFluent{
public WebhookInterceptorFluent() {
}
public WebhookInterceptorFluent(WebhookInterceptor instance) {
this.copyInstance(instance);
}
private List header = new ArrayList();
private ObjectReferenceBuilder objectRef;
private String url;
private Map additionalProperties;
protected void copyInstance(WebhookInterceptor instance) {
instance = (instance != null ? instance : new WebhookInterceptor());
if (instance != null) {
this.withHeader(instance.getHeader());
this.withObjectRef(instance.getObjectRef());
this.withUrl(instance.getUrl());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToHeader(int index,Param item) {
if (this.header == null) {this.header = new ArrayList();}
this.header.add(index, item);
return (A)this;
}
public A setToHeader(int index,Param item) {
if (this.header == null) {this.header = new ArrayList();}
this.header.set(index, item); return (A)this;
}
public A addToHeader(io.fabric8.tekton.pipeline.v1beta1.Param... items) {
if (this.header == null) {this.header = new ArrayList();}
for (Param item : items) {this.header.add(item);} return (A)this;
}
public A addAllToHeader(Collection items) {
if (this.header == null) {this.header = new ArrayList();}
for (Param item : items) {this.header.add(item);} return (A)this;
}
public A removeFromHeader(io.fabric8.tekton.pipeline.v1beta1.Param... items) {
if (this.header == null) return (A)this;
for (Param item : items) { this.header.remove(item);} return (A)this;
}
public A removeAllFromHeader(Collection items) {
if (this.header == null) return (A)this;
for (Param item : items) { this.header.remove(item);} return (A)this;
}
public List getHeader() {
return this.header;
}
public Param getHeader(int index) {
return this.header.get(index);
}
public Param getFirstHeader() {
return this.header.get(0);
}
public Param getLastHeader() {
return this.header.get(header.size() - 1);
}
public Param getMatchingHeader(Predicate predicate) {
for (Param item : header) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingHeader(Predicate predicate) {
for (Param item : header) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withHeader(List header) {
if (header != null) {
this.header = new ArrayList();
for (Param item : header) {
this.addToHeader(item);
}
} else {
this.header = null;
}
return (A) this;
}
public A withHeader(io.fabric8.tekton.pipeline.v1beta1.Param... header) {
if (this.header != null) {
this.header.clear();
_visitables.remove("header");
}
if (header != null) {
for (Param item : header) {
this.addToHeader(item);
}
}
return (A) this;
}
public boolean hasHeader() {
return this.header != null && !this.header.isEmpty();
}
public ObjectReference buildObjectRef() {
return this.objectRef != null ? this.objectRef.build() : null;
}
public A withObjectRef(ObjectReference objectRef) {
this._visitables.remove("objectRef");
if (objectRef != null) {
this.objectRef = new ObjectReferenceBuilder(objectRef);
this._visitables.get("objectRef").add(this.objectRef);
} else {
this.objectRef = null;
this._visitables.get("objectRef").remove(this.objectRef);
}
return (A) this;
}
public boolean hasObjectRef() {
return this.objectRef != null;
}
public ObjectRefNested withNewObjectRef() {
return new ObjectRefNested(null);
}
public ObjectRefNested withNewObjectRefLike(ObjectReference item) {
return new ObjectRefNested(item);
}
public ObjectRefNested editObjectRef() {
return withNewObjectRefLike(java.util.Optional.ofNullable(buildObjectRef()).orElse(null));
}
public ObjectRefNested editOrNewObjectRef() {
return withNewObjectRefLike(java.util.Optional.ofNullable(buildObjectRef()).orElse(new ObjectReferenceBuilder().build()));
}
public ObjectRefNested editOrNewObjectRefLike(ObjectReference item) {
return withNewObjectRefLike(java.util.Optional.ofNullable(buildObjectRef()).orElse(item));
}
public String getUrl() {
return this.url;
}
public A withUrl(String url) {
this.url = url;
return (A) this;
}
public boolean hasUrl() {
return this.url != 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;
WebhookInterceptorFluent that = (WebhookInterceptorFluent) o;
if (!java.util.Objects.equals(header, that.header)) return false;
if (!java.util.Objects.equals(objectRef, that.objectRef)) return false;
if (!java.util.Objects.equals(url, that.url)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(header, objectRef, url, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (header != null && !header.isEmpty()) { sb.append("header:"); sb.append(header + ","); }
if (objectRef != null) { sb.append("objectRef:"); sb.append(objectRef + ","); }
if (url != null) { sb.append("url:"); sb.append(url + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class ObjectRefNested extends ObjectReferenceFluent> implements Nested{
ObjectRefNested(ObjectReference item) {
this.builder = new ObjectReferenceBuilder(this, item);
}
ObjectReferenceBuilder builder;
public N and() {
return (N) WebhookInterceptorFluent.this.withObjectRef(builder.build());
}
public N endObjectRef() {
return and();
}
}
}