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

io.kroxylicious.proxy.config.VirtualClusterFluent Maven / Gradle / Ivy

package io.kroxylicious.proxy.config;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Optional;
import java.lang.SuppressWarnings;
import io.kroxylicious.proxy.config.model.Nested;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.lang.String;
import io.kroxylicious.proxy.config.tls.TlsFluent;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
import io.kroxylicious.proxy.config.model.BaseFluent;
import io.kroxylicious.proxy.config.tls.Tls;
import java.lang.Object;
import io.kroxylicious.proxy.config.tls.TlsBuilder;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class VirtualClusterFluent> extends BaseFluent{
  public VirtualClusterFluent() {
  }
  
  public VirtualClusterFluent(VirtualCluster instance) {
    this.copyInstance(instance);
  }
  private TargetClusterBuilder targetCluster;
  private ClusterNetworkAddressConfigProviderDefinition clusterNetworkAddressConfigProvider;
  private Optional tls =  Optional.empty();
  private boolean logNetwork;
  private boolean logFrames;
  
  protected void copyInstance(VirtualCluster instance) {
    if (instance != null) {
          this.withTargetCluster(instance.targetCluster());
          this.withClusterNetworkAddressConfigProvider(instance.clusterNetworkAddressConfigProvider());
          this.withTls(instance.tls());
          this.withLogNetwork(instance.logNetwork());
          this.withLogFrames(instance.logFrames());
        }
  }
  
  public TargetCluster buildTargetCluster() {
    return this.targetCluster != null ? this.targetCluster.build() : null;
  }
  
  public A withTargetCluster(TargetCluster targetCluster) {
    this._visitables.remove("targetCluster");
    if (targetCluster != null) {
        this.targetCluster = new TargetClusterBuilder(targetCluster);
        this._visitables.get("targetCluster").add(this.targetCluster);
    } else {
        this.targetCluster = null;
        this._visitables.get("targetCluster").remove(this.targetCluster);
    }
    return (A) this;
  }
  
  public boolean hasTargetCluster() {
    return this.targetCluster != null;
  }
  
  public TargetClusterNested withNewTargetCluster() {
    return new TargetClusterNested(null);
  }
  
  public TargetClusterNested withNewTargetClusterLike(TargetCluster item) {
    return new TargetClusterNested(item);
  }
  
  public TargetClusterNested editTargetCluster() {
    return withNewTargetClusterLike(java.util.Optional.ofNullable(buildTargetCluster()).orElse(null));
  }
  
  public TargetClusterNested editOrNewTargetCluster() {
    return withNewTargetClusterLike(java.util.Optional.ofNullable(buildTargetCluster()).orElse(new TargetClusterBuilder().build()));
  }
  
  public TargetClusterNested editOrNewTargetClusterLike(TargetCluster item) {
    return withNewTargetClusterLike(java.util.Optional.ofNullable(buildTargetCluster()).orElse(item));
  }
  
  public ClusterNetworkAddressConfigProviderDefinition getClusterNetworkAddressConfigProvider() {
    return this.clusterNetworkAddressConfigProvider;
  }
  
  public A withClusterNetworkAddressConfigProvider(ClusterNetworkAddressConfigProviderDefinition clusterNetworkAddressConfigProvider) {
    this.clusterNetworkAddressConfigProvider = clusterNetworkAddressConfigProvider;
    return (A) this;
  }
  
  public boolean hasClusterNetworkAddressConfigProvider() {
    return this.clusterNetworkAddressConfigProvider != null;
  }
  
  public A withNewClusterNetworkAddressConfigProvider(String type,Object config) {
    return (A)withClusterNetworkAddressConfigProvider(new ClusterNetworkAddressConfigProviderDefinition(type, config));
  }
  
  public A withTls(Optional tls) {
    if (tls == null || !tls.isPresent()) {
      this.tls = java.util.Optional.empty();
    } else {
        TlsBuilder b = new TlsBuilder(tls.get());;
        _visitables.get("tls").add(b);
        this.tls = java.util.Optional.of(b);
    }
    return (A) this;
  }
  
  public A withTls(Tls tls) {
    if (tls == null) { this.tls = Optional.empty(); } else {TlsBuilder b = new TlsBuilder(tls); _visitables.get("tls").add(b); this.tls = Optional.of(b); } return (A) this;
  }
  
  public Optional buildTls() {
    return (Optional) (this.tls != null && this.tls.isPresent() ? java.util.Optional.of(this.tls.get().build()) : java.util.Optional.empty());
  }
  
  public boolean hasTls() {
    return this.tls != null && this.tls.isPresent();
  }
  
  public TlsNested withNewTls() {
    return new TlsNested(null);
  }
  
  public TlsNested withNewTlsLike(Tls item) {
    return new TlsNested(item);
  }
  
  public TlsNested editTls() {
    return withNewTlsLike(java.util.Optional.ofNullable(buildTls()).flatMap(java.util.function.Function.identity()).orElse(null));
  }
  
  public TlsNested editOrNewTls() {
    return withNewTlsLike(java.util.Optional.ofNullable(buildTls()).flatMap(java.util.function.Function.identity()).orElse(new TlsBuilder().build()));
  }
  
  public TlsNested editOrNewTlsLike(Tls item) {
    return withNewTlsLike(java.util.Optional.ofNullable(buildTls()).flatMap(java.util.function.Function.identity()).orElse(item));
  }
  
  public boolean isLogNetwork() {
    return this.logNetwork;
  }
  
  public A withLogNetwork(boolean logNetwork) {
    this.logNetwork = logNetwork;
    return (A) this;
  }
  
  public boolean hasLogNetwork() {
    return true;
  }
  
  public boolean isLogFrames() {
    return this.logFrames;
  }
  
  public A withLogFrames(boolean logFrames) {
    this.logFrames = logFrames;
    return (A) this;
  }
  
  public boolean hasLogFrames() {
    return true;
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    VirtualClusterFluent that = (VirtualClusterFluent) o;
    if (!java.util.Objects.equals(targetCluster, that.targetCluster)) return false;
    if (!java.util.Objects.equals(clusterNetworkAddressConfigProvider, that.clusterNetworkAddressConfigProvider)) return false;
    if (!java.util.Objects.equals(tls, that.tls)) return false;
    if (logNetwork != that.logNetwork) return false;
    if (logFrames != that.logFrames) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(targetCluster,  clusterNetworkAddressConfigProvider,  tls,  logNetwork,  logFrames,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (targetCluster != null) { sb.append("targetCluster:"); sb.append(targetCluster + ","); }
    if (clusterNetworkAddressConfigProvider != null) { sb.append("clusterNetworkAddressConfigProvider:"); sb.append(clusterNetworkAddressConfigProvider + ","); }
    if (tls != null) { sb.append("tls:"); sb.append(tls + ","); }
    sb.append("logNetwork:"); sb.append(logNetwork + ",");
    sb.append("logFrames:"); sb.append(logFrames);
    sb.append("}");
    return sb.toString();
  }
  
  public A withLogNetwork() {
    return withLogNetwork(true);
  }
  
  public A withLogFrames() {
    return withLogFrames(true);
  }
  public class TargetClusterNested extends TargetClusterFluent> implements Nested{
    TargetClusterNested(TargetCluster item) {
      this.builder = new TargetClusterBuilder(this, item);
    }
    TargetClusterBuilder builder;
    
    public N and() {
      return (N) VirtualClusterFluent.this.withTargetCluster(builder.build());
    }
    
    public N endTargetCluster() {
      return and();
    }
    
  
  }
  public class TlsNested extends TlsFluent> implements Nested{
    TlsNested(Tls item) {
      this.builder = new TlsBuilder(this, item);
    }
    TlsBuilder builder;
    
    public N and() {
      return (N) VirtualClusterFluent.this.withTls(builder.build());
    }
    
    public N endTls() {
      return and();
    }
    
  
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy