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

io.dekorate.jaeger.config.JaegerAgentConfigFluentImpl Maven / Gradle / Ivy

There is a newer version: 4.1.4
Show newest version
package io.dekorate.jaeger.config;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
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.Integer;
import io.dekorate.kubernetes.config.PortBuilder;
import java.util.Collection;
import java.lang.Object;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class JaegerAgentConfigFluentImpl> extends ConfigurationFluentImpl implements JaegerAgentConfigFluent{
  public JaegerAgentConfigFluentImpl() {
  }
  public JaegerAgentConfigFluentImpl(JaegerAgentConfig instance) {
    this.withProject(instance.getProject()); 
    this.withAttributes(instance.getAttributes()); 
    this.withOperatorEnabled(instance.getOperatorEnabled()); 
    this.withVersion(instance.getVersion()); 
    this.withCollector(instance.getCollector()); 
    this.withPorts(instance.getPorts()); 
  }
  private Boolean operatorEnabled;
  private String version;
  private CollectorBuilder collector;
  private ArrayList ports = new ArrayList();
  public Boolean getOperatorEnabled() {
    return this.operatorEnabled;
  }
  public A withOperatorEnabled(Boolean operatorEnabled) {
    this.operatorEnabled=operatorEnabled; return (A) this;
  }
  public Boolean hasOperatorEnabled() {
    return this.operatorEnabled != null;
  }
  public String getVersion() {
    return this.version;
  }
  public A withVersion(String version) {
    this.version=version; return (A) this;
  }
  public Boolean hasVersion() {
    return this.version != null;
  }
  
  /**
   * This method has been deprecated, please use method buildCollector instead.
   * @return The buildable object.
   */
  @Deprecated
  public Collector getCollector() {
    return this.collector!=null ?this.collector.build():null;
  }
  public Collector buildCollector() {
    return this.collector!=null ?this.collector.build():null;
  }
  public A withCollector(Collector collector) {
    _visitables.get("collector").remove(this.collector);
    if (collector!=null){ this.collector= new CollectorBuilder(collector); _visitables.get("collector").add(this.collector);} else { this.collector = null; _visitables.get("collector").remove(this.collector); } return (A) this;
  }
  public Boolean hasCollector() {
    return this.collector != null;
  }
  public A withNewCollector(String host,String name,String namespace,Integer port) {
    return (A)withCollector(new Collector(host, name, namespace, port));
  }
  public JaegerAgentConfigFluent.CollectorNested withNewCollector() {
    return new JaegerAgentConfigFluentImpl.CollectorNestedImpl();
  }
  public JaegerAgentConfigFluent.CollectorNested withNewCollectorLike(Collector item) {
    return new JaegerAgentConfigFluentImpl.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(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 (Port item :ports){ this.addToPorts(item);}} return (A) this;
  }
  
  /**
   * This method has been deprecated, please use method buildPorts instead.
   */
  @Deprecated
  public Port[] getPorts() {
    int size = ports != null ? ports.size() : 0;
Port[] result = new Port[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : ports) {
    result[index++]=builder.build();
}
return result;

  }
  public Port[] buildPorts() {
    int size = ports != null ? ports.size() : 0;
Port[] result = new Port[size];
if (size == 0) {
   return result;
}
int index = 0;
for (VisitableBuilder builder : ports) {
    result[index++]=builder.build();
}
return result;

  }
  public Port buildPort(Integer index) {
    return this.ports.get(index).build();
  }
  public Port buildFirstPort() {
    return this.ports.get(0).build();
  }
  public Port buildLastPort() {
    return this.ports.get(ports.size() - 1).build();
  }
  public 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(Integer index,Port item) {
    if (this.ports == null) {this.ports = new ArrayList();}
    PortBuilder builder = new 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(Integer index,Port item) {
    if (this.ports == null) {this.ports = new ArrayList();}
    PortBuilder builder = new 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 (Port item : items) {PortBuilder builder = new PortBuilder(item);_visitables.get("ports").add(builder);this.ports.add(builder);} return (A)this;
  }
  public A addAllToPorts(Collection items) {
    if (this.ports == null) {this.ports = new ArrayList();}
    for (Port item : items) {PortBuilder builder = new PortBuilder(item);_visitables.get("ports").add(builder);this.ports.add(builder);} return (A)this;
  }
  public A removeFromPorts(io.dekorate.kubernetes.config.Port... items) {
    for (Port item : items) {PortBuilder builder = new PortBuilder(item);_visitables.get("ports").remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
  }
  public A removeAllFromPorts(Collection items) {
    for (Port item : items) {PortBuilder builder = new PortBuilder(item);_visitables.get("ports").remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromPorts(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.PortsNested addNewPort() {
    return new JaegerAgentConfigFluentImpl.PortsNestedImpl();
  }
  public JaegerAgentConfigFluent.PortsNested addNewPortLike(Port item) {
    return new JaegerAgentConfigFluentImpl.PortsNestedImpl(-1, item);
  }
  public JaegerAgentConfigFluent.PortsNested setNewPortLike(Integer index,Port item) {
    return new JaegerAgentConfigFluentImpl.PortsNestedImpl(index, item);
  }
  public JaegerAgentConfigFluent.PortsNested editPort(Integer index) {
    if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
    return setNewPortLike(index, buildPort(index));
  }
  public JaegerAgentConfigFluent.PortsNested editFirstPort() {
    if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
    return setNewPortLike(0, buildPort(0));
  }
  public JaegerAgentConfigFluent.PortsNested 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.PortsNested editMatchingPort(Predicate predicate) {
    int index = -1;
    for (int i=0;i extends CollectorFluentImpl> implements JaegerAgentConfigFluent.CollectorNested,Nested{
    CollectorNestedImpl(Collector item) {
      this.builder = new CollectorBuilder(this, item);
    }
    CollectorNestedImpl() {
      this.builder = new CollectorBuilder(this);
    }
    CollectorBuilder builder;
    public N and() {
      return (N) JaegerAgentConfigFluentImpl.this.withCollector(builder.build());
    }
    public N endCollector() {
      return and();
    }
    
  }
  class PortsNestedImpl extends PortFluentImpl> implements JaegerAgentConfigFluent.PortsNested,Nested{
    PortsNestedImpl(Integer index,Port item) {
      this.index = index;
      this.builder = new PortBuilder(this, item);
    }
    PortsNestedImpl() {
      this.index = -1;
      this.builder = new PortBuilder(this);
    }
    PortBuilder builder;
    Integer index;
    public N and() {
      return (N) JaegerAgentConfigFluentImpl.this.setToPorts(index,builder.build());
    }
    public N endPort() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy