io.dekorate.jaeger.config.JaegerAgentConfigFluentImpl Maven / Gradle / Ivy
package io.dekorate.jaeger.config;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.StringBuilder;
import io.dekorate.kubernetes.config.Port;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import io.dekorate.kubernetes.config.PortFluentImpl;
import java.lang.Deprecated;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import io.dekorate.kubernetes.config.ConfigurationFluentImpl;
import java.lang.StringBuffer;
import io.dekorate.kubernetes.config.PortBuilder;
import java.util.Collection;
import java.lang.Object;
public class JaegerAgentConfigFluentImpl> extends ConfigurationFluentImpl implements JaegerAgentConfigFluent {
private boolean operatorEnabled = false;
private String version = "1.10";
private CollectorBuilder collector = new CollectorBuilder();
private List ports = new ArrayList();
public JaegerAgentConfigFluentImpl() {
}
public JaegerAgentConfigFluentImpl(JaegerAgentConfig instance) {
this.withProject(instance.getProject());
this.withAttributes(instance.getAttributes());
this.withOperatorEnabled(instance.isOperatorEnabled());
this.withVersion(instance.getVersion());
this.withCollector(instance.getCollector());
this.withPorts(instance.getPorts());
}
public boolean isOperatorEnabled() {
return this.operatorEnabled;
}
public A withOperatorEnabled(boolean operatorEnabled) {
this.operatorEnabled=operatorEnabled; return (A) this;
}
public Boolean hasOperatorEnabled() {
return true;
}
public String getVersion() {
return this.version;
}
public A withVersion(String version) {
this.version=version; return (A) this;
}
public Boolean hasVersion() {
return this.version != null;
}
public A withNewVersion(String arg1) {
return (A)withVersion(new String(arg1));
}
public A withNewVersion(StringBuilder arg1) {
return (A)withVersion(new String(arg1));
}
public A withNewVersion(StringBuffer arg1) {
return (A)withVersion(new String(arg1));
}
/**
* This method has been deprecated, please use method buildCollector instead.
* @return The buildable object.
*/
@Deprecated public io.dekorate.jaeger.config.Collector getCollector() {
return this.collector!=null?this.collector.build():null;
}
public io.dekorate.jaeger.config.Collector buildCollector() {
return this.collector!=null?this.collector.build():null;
}
public A withCollector(io.dekorate.jaeger.config.Collector collector) {
_visitables.get("collector").remove(this.collector);
if (collector!=null){ this.collector= new CollectorBuilder(collector); _visitables.get("collector").add(this.collector);} return (A) this;
}
public Boolean hasCollector() {
return this.collector != null;
}
public A withNewCollector(String host,String name,String namespace,int port) {
return (A)withCollector(new Collector(host, name, namespace, port));
}
public JaegerAgentConfigFluent.CollectorNested withNewCollector() {
return new CollectorNestedImpl();
}
public JaegerAgentConfigFluent.CollectorNested withNewCollectorLike(io.dekorate.jaeger.config.Collector item) {
return new CollectorNestedImpl(item);
}
public JaegerAgentConfigFluent.CollectorNested editCollector() {
return withNewCollectorLike(getCollector());
}
public JaegerAgentConfigFluent.CollectorNested editOrNewCollector() {
return withNewCollectorLike(getCollector() != null ? getCollector(): new CollectorBuilder().build());
}
public JaegerAgentConfigFluent.CollectorNested editOrNewCollectorLike(io.dekorate.jaeger.config.Collector item) {
return withNewCollectorLike(getCollector() != null ? getCollector(): item);
}
public A withPorts(io.dekorate.kubernetes.config.Port... ports) {
if (this.ports != null) {this.ports.clear();}
if (ports != null) {for (io.dekorate.kubernetes.config.Port item :ports){ this.addToPorts(item);}} return (A) this;
}
/**
* This method has been deprecated, please use method buildPorts instead.
*/
@Deprecated public io.dekorate.kubernetes.config.Port[] getPorts() {
int size = ports != null ? ports.size() : 0;
io.dekorate.kubernetes.config.Port[] result = new io.dekorate.kubernetes.config.Port[size];
if (size == 0) {
return result;
}
int index = 0;
for (VisitableBuilder extends io.dekorate.kubernetes.config.Port,?> builder : ports) {
result[index++]=builder.build();
}
return result;
}
public io.dekorate.kubernetes.config.Port[] buildPorts() {
int size = ports != null ? ports.size() : 0;
io.dekorate.kubernetes.config.Port[] result = new io.dekorate.kubernetes.config.Port[size];
if (size == 0) {
return result;
}
int index = 0;
for (VisitableBuilder extends io.dekorate.kubernetes.config.Port,?> builder : ports) {
result[index++]=builder.build();
}
return result;
}
public io.dekorate.kubernetes.config.Port buildPort(int index) {
return this.ports.get(index).build();
}
public io.dekorate.kubernetes.config.Port buildFirstPort() {
return this.ports.get(0).build();
}
public io.dekorate.kubernetes.config.Port buildLastPort() {
return this.ports.get(ports.size() - 1).build();
}
public io.dekorate.kubernetes.config.Port buildMatchingPort(Predicate predicate) {
for (PortBuilder item: ports) { if(predicate.test(item)){ return item.build();} } return null;
}
public Boolean hasMatchingPort(Predicate predicate) {
for (PortBuilder item: ports) { if(predicate.test(item)){ return true;} } return false;
}
public A addToPorts(int index,io.dekorate.kubernetes.config.Port item) {
if (this.ports == null) {this.ports = new ArrayList();}
io.dekorate.kubernetes.config.PortBuilder builder = new io.dekorate.kubernetes.config.PortBuilder(item);_visitables.get("ports").add(index >= 0 ? index : _visitables.get("ports").size(), builder);this.ports.add(index >= 0 ? index : ports.size(), builder); return (A)this;
}
public A setToPorts(int index,io.dekorate.kubernetes.config.Port item) {
if (this.ports == null) {this.ports = new ArrayList();}
io.dekorate.kubernetes.config.PortBuilder builder = new io.dekorate.kubernetes.config.PortBuilder(item);
if (index < 0 || index >= _visitables.get("ports").size()) { _visitables.get("ports").add(builder); } else { _visitables.get("ports").set(index, builder);}
if (index < 0 || index >= ports.size()) { ports.add(builder); } else { ports.set(index, builder);}
return (A)this;
}
public A addToPorts(io.dekorate.kubernetes.config.Port... items) {
if (this.ports == null) {this.ports = new ArrayList();}
for (io.dekorate.kubernetes.config.Port item : items) {io.dekorate.kubernetes.config.PortBuilder builder = new io.dekorate.kubernetes.config.PortBuilder(item);_visitables.get("ports").add(builder);this.ports.add(builder);} return (A)this;
}
public A addAllToConfigPorts(Collection items) {
if (this.ports == null) {this.ports = new ArrayList();}
for (io.dekorate.kubernetes.config.Port item : items) {io.dekorate.kubernetes.config.PortBuilder builder = new io.dekorate.kubernetes.config.PortBuilder(item);_visitables.get("ports").add(builder);this.ports.add(builder);} return (A)this;
}
public A removeFromPorts(io.dekorate.kubernetes.config.Port... items) {
for (io.dekorate.kubernetes.config.Port item : items) {io.dekorate.kubernetes.config.PortBuilder builder = new io.dekorate.kubernetes.config.PortBuilder(item);_visitables.get("ports").remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
}
public A removeAllFromConfigPorts(Collection items) {
for (io.dekorate.kubernetes.config.Port item : items) {io.dekorate.kubernetes.config.PortBuilder builder = new io.dekorate.kubernetes.config.PortBuilder(item);_visitables.get("ports").remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
}
public A removeMatchingFromConfigPorts(Predicate predicate) {
if (ports == null) return (A) this;
final Iterator each = ports.iterator();
final List visitables = _visitables.get("ports");
while (each.hasNext()) {
PortBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public Boolean hasPorts() {
return ports != null && !ports.isEmpty();
}
public JaegerAgentConfigFluent.ConfigPortsNested addNewConfigPort() {
return new ConfigPortsNestedImpl();
}
public JaegerAgentConfigFluent.ConfigPortsNested addNewPortLike(io.dekorate.kubernetes.config.Port item) {
return new ConfigPortsNestedImpl(-1, item);
}
public JaegerAgentConfigFluent.ConfigPortsNested setNewPortLike(int index,io.dekorate.kubernetes.config.Port item) {
return new ConfigPortsNestedImpl(index, item);
}
public JaegerAgentConfigFluent.ConfigPortsNested editPort(int index) {
if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
return setNewPortLike(index, buildPort(index));
}
public JaegerAgentConfigFluent.ConfigPortsNested editFirstPort() {
if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
return setNewPortLike(0, buildPort(0));
}
public JaegerAgentConfigFluent.ConfigPortsNested editLastPort() {
int index = ports.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last ports. The list is empty.");
return setNewPortLike(index, buildPort(index));
}
public JaegerAgentConfigFluent.ConfigPortsNested editMatchingPort(Predicate predicate) {
int index = -1;
for (int i=0;i extends CollectorFluentImpl> implements JaegerAgentConfigFluent.CollectorNested,io.fabric8.kubernetes.api.builder.Nested {
private final CollectorBuilder builder;
CollectorNestedImpl(io.dekorate.jaeger.config.Collector item) {
this.builder = new CollectorBuilder(this, item);
}
CollectorNestedImpl() {
this.builder = new CollectorBuilder(this);
}
public N and() {
return (N) JaegerAgentConfigFluentImpl.this.withCollector(builder.build());
}
public N endCollector() {
return and();
}
}
public class ConfigPortsNestedImpl extends PortFluentImpl> implements JaegerAgentConfigFluent.ConfigPortsNested,io.fabric8.kubernetes.api.builder.Nested {
private final PortBuilder builder;
private final int index;
ConfigPortsNestedImpl(int index,io.dekorate.kubernetes.config.Port item) {
this.index = index;
this.builder = new PortBuilder(this, item);
}
ConfigPortsNestedImpl() {
this.index = -1;
this.builder = new PortBuilder(this);
}
public N and() {
return (N) JaegerAgentConfigFluentImpl.this.setToPorts(index,builder.build());
}
public N endConfigPort() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy