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

io.kroxylicious.proxy.config.tls.TlsFluent Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.kroxylicious.proxy.config.tls;

import io.kroxylicious.proxy.config.model.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.kroxylicious.proxy.config.model.Nested;
import java.lang.String;
import io.kroxylicious.proxy.config.model.BaseFluent;
import java.lang.Object;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class TlsFluent> extends BaseFluent{
  public TlsFluent() {
  }
  
  public TlsFluent(Tls instance) {
    this.copyInstance(instance);
  }
  private VisitableBuilder key;
  private VisitableBuilder trust;
  
  protected void copyInstance(Tls instance) {
    if (instance != null) {
          this.withKey(instance.key());
          this.withTrust(instance.trust());
        }
  }
  
  public KeyProvider buildKey() {
    return this.key != null ? this.key.build() : null;
  }
  
  public A withKey(KeyProvider key) {
    if (key == null) {
        this.key = null;
        this._visitables.remove("key");
        return (A) this;
    } else {
        VisitableBuilder builder = builder(key);;
        this._visitables.get("key").clear();
        this._visitables.get("key").add(builder);
        this.key = builder;
        return (A) this;
    }
  }
  
  public boolean hasKey() {
    return this.key != null;
  }
  
  public KeyStoreKeyNested withNewKeyStoreKey() {
    return new KeyStoreKeyNested(null);
  }
  
  public KeyStoreKeyNested withNewKeyStoreKeyLike(KeyStore item) {
    return new KeyStoreKeyNested(item);
  }
  
  public KeyPairKeyNested withNewKeyPairKey() {
    return new KeyPairKeyNested(null);
  }
  
  public KeyPairKeyNested withNewKeyPairKeyLike(KeyPair item) {
    return new KeyPairKeyNested(item);
  }
  
  public TrustProvider buildTrust() {
    return this.trust != null ? this.trust.build() : null;
  }
  
  public A withTrust(TrustProvider trust) {
    if (trust == null) {
        this.trust = null;
        this._visitables.remove("trust");
        return (A) this;
    } else {
        VisitableBuilder builder = builder(trust);;
        this._visitables.get("trust").clear();
        this._visitables.get("trust").add(builder);
        this.trust = builder;
        return (A) this;
    }
  }
  
  public boolean hasTrust() {
    return this.trust != null;
  }
  
  public InsecureTlsTrustNested withNewInsecureTlsTrust() {
    return new InsecureTlsTrustNested(null);
  }
  
  public InsecureTlsTrustNested withNewInsecureTlsTrustLike(InsecureTls item) {
    return new InsecureTlsTrustNested(item);
  }
  
  public A withNewInsecureTlsTrust(boolean insecure) {
    return (A)withTrust(new InsecureTls(insecure));
  }
  
  public TrustStoreTrustNested withNewTrustStoreTrust() {
    return new TrustStoreTrustNested(null);
  }
  
  public TrustStoreTrustNested withNewTrustStoreTrustLike(TrustStore item) {
    return new TrustStoreTrustNested(item);
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    TlsFluent that = (TlsFluent) o;
    if (!java.util.Objects.equals(key, that.key)) return false;
    if (!java.util.Objects.equals(trust, that.trust)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(key,  trust,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (key != null) { sb.append("key:"); sb.append(key + ","); }
    if (trust != null) { sb.append("trust:"); sb.append(trust); }
    sb.append("}");
    return sb.toString();
  }
  
  protected static VisitableBuilder builder(Object item) {
    switch (item.getClass().getName()) {
    case "io.kroxylicious.proxy.config.tls."+"KeyStore": return (VisitableBuilder)new KeyStoreBuilder((KeyStore) item);
    case "io.kroxylicious.proxy.config.tls."+"KeyPair": return (VisitableBuilder)new KeyPairBuilder((KeyPair) item);
    case "io.kroxylicious.proxy.config.tls."+"InsecureTls": return (VisitableBuilder)new InsecureTlsBuilder((InsecureTls) item);
    case "io.kroxylicious.proxy.config.tls."+"TrustStore": return (VisitableBuilder)new TrustStoreBuilder((TrustStore) item);
    }
     return (VisitableBuilder)builderOf(item);
  }
  public class KeyStoreKeyNested extends KeyStoreFluent> implements Nested{
    KeyStoreKeyNested(KeyStore item) {
      this.builder = new KeyStoreBuilder(this, item);
    }
    KeyStoreBuilder builder;
    
    public N and() {
      return (N) TlsFluent.this.withKey(builder.build());
    }
    
    public N endKeyStoreKey() {
      return and();
    }
    
  
  }
  public class KeyPairKeyNested extends KeyPairFluent> implements Nested{
    KeyPairKeyNested(KeyPair item) {
      this.builder = new KeyPairBuilder(this, item);
    }
    KeyPairBuilder builder;
    
    public N and() {
      return (N) TlsFluent.this.withKey(builder.build());
    }
    
    public N endKeyPairKey() {
      return and();
    }
    
  
  }
  public class InsecureTlsTrustNested extends InsecureTlsFluent> implements Nested{
    InsecureTlsTrustNested(InsecureTls item) {
      this.builder = new InsecureTlsBuilder(this, item);
    }
    InsecureTlsBuilder builder;
    
    public N and() {
      return (N) TlsFluent.this.withTrust(builder.build());
    }
    
    public N endInsecureTlsTrust() {
      return and();
    }
    
  
  }
  public class TrustStoreTrustNested extends TrustStoreFluent> implements Nested{
    TrustStoreTrustNested(TrustStore item) {
      this.builder = new TrustStoreBuilder(this, item);
    }
    TrustStoreBuilder builder;
    
    public N and() {
      return (N) TlsFluent.this.withTrust(builder.build());
    }
    
    public N endTrustStoreTrust() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy