io.fabric8.knative.internal.networking.v1alpha1.HTTPIngressPathFluent Maven / Gradle / Ivy
package io.fabric8.knative.internal.networking.v1alpha1;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
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.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class HTTPIngressPathFluent> extends BaseFluent{
public HTTPIngressPathFluent() {
}
public HTTPIngressPathFluent(HTTPIngressPath instance) {
instance = (instance != null ? instance : new HTTPIngressPath());
if (instance != null) {
this.withAppendHeaders(instance.getAppendHeaders());
this.withHeaders(instance.getHeaders());
this.withPath(instance.getPath());
this.withRewriteHost(instance.getRewriteHost());
this.withSplits(instance.getSplits());
this.withAppendHeaders(instance.getAppendHeaders());
this.withHeaders(instance.getHeaders());
this.withPath(instance.getPath());
this.withRewriteHost(instance.getRewriteHost());
this.withSplits(instance.getSplits());
}
}
private Map appendHeaders;
private Map headers;
private String path;
private String rewriteHost;
private ArrayList splits = new ArrayList();
public A addToAppendHeaders(String key,String value) {
if(this.appendHeaders == null && key != null && value != null) { this.appendHeaders = new LinkedHashMap(); }
if(key != null && value != null) {this.appendHeaders.put(key, value);} return (A)this;
}
public A addToAppendHeaders(Map map) {
if(this.appendHeaders == null && map != null) { this.appendHeaders = new LinkedHashMap(); }
if(map != null) { this.appendHeaders.putAll(map);} return (A)this;
}
public A removeFromAppendHeaders(String key) {
if(this.appendHeaders == null) { return (A) this; }
if(key != null && this.appendHeaders != null) {this.appendHeaders.remove(key);} return (A)this;
}
public A removeFromAppendHeaders(Map map) {
if(this.appendHeaders == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.appendHeaders != null){this.appendHeaders.remove(key);}}} return (A)this;
}
public Map getAppendHeaders() {
return this.appendHeaders;
}
public A withAppendHeaders(Map appendHeaders) {
if (appendHeaders == null) { this.appendHeaders = null;} else {this.appendHeaders = new LinkedHashMap(appendHeaders);} return (A) this;
}
public boolean hasAppendHeaders() {
return this.appendHeaders != null;
}
public A addToHeaders(String key,HeaderMatch value) {
if(this.headers == null && key != null && value != null) { this.headers = new LinkedHashMap(); }
if(key != null && value != null) {this.headers.put(key, value);} return (A)this;
}
public A addToHeaders(Map map) {
if(this.headers == null && map != null) { this.headers = new LinkedHashMap(); }
if(map != null) { this.headers.putAll(map);} return (A)this;
}
public A removeFromHeaders(String key) {
if(this.headers == null) { return (A) this; }
if(key != null && this.headers != null) {this.headers.remove(key);} return (A)this;
}
public A removeFromHeaders(Map map) {
if(this.headers == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.headers != null){this.headers.remove(key);}}} return (A)this;
}
public Map getHeaders() {
return this.headers;
}
public A withHeaders(Map headers) {
if (headers == null) { this.headers = null;} else {this.headers = new LinkedHashMap(headers);} return (A) this;
}
public boolean hasHeaders() {
return this.headers != null;
}
public String getPath() {
return this.path;
}
public A withPath(String path) {
this.path=path; return (A) this;
}
public boolean hasPath() {
return this.path != null;
}
public String getRewriteHost() {
return this.rewriteHost;
}
public A withRewriteHost(String rewriteHost) {
this.rewriteHost=rewriteHost; return (A) this;
}
public boolean hasRewriteHost() {
return this.rewriteHost != null;
}
public A addToSplits(int index,IngressBackendSplit item) {
if (this.splits == null) {this.splits = new ArrayList();}
IngressBackendSplitBuilder builder = new IngressBackendSplitBuilder(item);
if (index < 0 || index >= splits.size()) { _visitables.get("splits").add(builder); splits.add(builder); } else { _visitables.get("splits").add(index, builder); splits.add(index, builder);}
return (A)this;
}
public A setToSplits(int index,IngressBackendSplit item) {
if (this.splits == null) {this.splits = new ArrayList();}
IngressBackendSplitBuilder builder = new IngressBackendSplitBuilder(item);
if (index < 0 || index >= splits.size()) { _visitables.get("splits").add(builder); splits.add(builder); } else { _visitables.get("splits").set(index, builder); splits.set(index, builder);}
return (A)this;
}
public A addToSplits(io.fabric8.knative.internal.networking.v1alpha1.IngressBackendSplit... items) {
if (this.splits == null) {this.splits = new ArrayList();}
for (IngressBackendSplit item : items) {IngressBackendSplitBuilder builder = new IngressBackendSplitBuilder(item);_visitables.get("splits").add(builder);this.splits.add(builder);} return (A)this;
}
public A addAllToSplits(Collection items) {
if (this.splits == null) {this.splits = new ArrayList();}
for (IngressBackendSplit item : items) {IngressBackendSplitBuilder builder = new IngressBackendSplitBuilder(item);_visitables.get("splits").add(builder);this.splits.add(builder);} return (A)this;
}
public A removeFromSplits(io.fabric8.knative.internal.networking.v1alpha1.IngressBackendSplit... items) {
if (this.splits == null) return (A)this;
for (IngressBackendSplit item : items) {IngressBackendSplitBuilder builder = new IngressBackendSplitBuilder(item);_visitables.get("splits").remove(builder); this.splits.remove(builder);} return (A)this;
}
public A removeAllFromSplits(Collection items) {
if (this.splits == null) return (A)this;
for (IngressBackendSplit item : items) {IngressBackendSplitBuilder builder = new IngressBackendSplitBuilder(item);_visitables.get("splits").remove(builder); this.splits.remove(builder);} return (A)this;
}
public A removeMatchingFromSplits(Predicate predicate) {
if (splits == null) return (A) this;
final Iterator each = splits.iterator();
final List visitables = _visitables.get("splits");
while (each.hasNext()) {
IngressBackendSplitBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildSplits() {
return splits != null ? build(splits) : null;
}
public IngressBackendSplit buildSplit(int index) {
return this.splits.get(index).build();
}
public IngressBackendSplit buildFirstSplit() {
return this.splits.get(0).build();
}
public IngressBackendSplit buildLastSplit() {
return this.splits.get(splits.size() - 1).build();
}
public IngressBackendSplit buildMatchingSplit(Predicate predicate) {
for (IngressBackendSplitBuilder item: splits) { if(predicate.test(item)){ return item.build();} } return null;
}
public boolean hasMatchingSplit(Predicate predicate) {
for (IngressBackendSplitBuilder item: splits) { if(predicate.test(item)){ return true;} } return false;
}
public A withSplits(List splits) {
if (this.splits != null) { _visitables.get("splits").clear();}
if (splits != null) {this.splits = new ArrayList(); for (IngressBackendSplit item : splits){this.addToSplits(item);}} else { this.splits = null;} return (A) this;
}
public A withSplits(io.fabric8.knative.internal.networking.v1alpha1.IngressBackendSplit... splits) {
if (this.splits != null) {this.splits.clear(); _visitables.remove("splits"); }
if (splits != null) {for (IngressBackendSplit item :splits){ this.addToSplits(item);}} return (A) this;
}
public boolean hasSplits() {
return splits != null && !splits.isEmpty();
}
public SplitsNested addNewSplit() {
return new SplitsNested(-1, null);
}
public SplitsNested addNewSplitLike(IngressBackendSplit item) {
return new SplitsNested(-1, item);
}
public SplitsNested setNewSplitLike(int index,IngressBackendSplit item) {
return new SplitsNested(index, item);
}
public SplitsNested editSplit(int index) {
if (splits.size() <= index) throw new RuntimeException("Can't edit splits. Index exceeds size.");
return setNewSplitLike(index, buildSplit(index));
}
public SplitsNested editFirstSplit() {
if (splits.size() == 0) throw new RuntimeException("Can't edit first splits. The list is empty.");
return setNewSplitLike(0, buildSplit(0));
}
public SplitsNested editLastSplit() {
int index = splits.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last splits. The list is empty.");
return setNewSplitLike(index, buildSplit(index));
}
public SplitsNested editMatchingSplit(Predicate predicate) {
int index = -1;
for (int i=0;i extends IngressBackendSplitFluent> implements Nested{
SplitsNested(int index,IngressBackendSplit item) {
this.index = index;
this.builder = new IngressBackendSplitBuilder(this, item);
}
IngressBackendSplitBuilder builder;
int index;
public N and() {
return (N) HTTPIngressPathFluent.this.setToSplits(index,builder.build());
}
public N endSplit() {
return and();
}
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy