io.kroxylicious.proxy.config.tls.TrustStoreFluent Maven / Gradle / Ivy
package io.kroxylicious.proxy.config.tls;
import io.kroxylicious.proxy.config.secret.InlinePasswordFluent;
import io.kroxylicious.proxy.config.model.VisitableBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.lang.SuppressWarnings;
import io.kroxylicious.proxy.config.model.Nested;
import io.kroxylicious.proxy.config.secret.InlinePassword;
import java.lang.String;
import io.kroxylicious.proxy.config.secret.PasswordProvider;
import com.fasterxml.jackson.annotation.JsonAlias;
import io.kroxylicious.proxy.config.secret.FilePassword;
import io.kroxylicious.proxy.config.model.BaseFluent;
import io.kroxylicious.proxy.config.secret.InlinePasswordBuilder;
import io.kroxylicious.proxy.config.secret.FilePasswordFluent;
import java.lang.Object;
import io.kroxylicious.proxy.config.secret.FilePasswordBuilder;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class TrustStoreFluent> extends BaseFluent{
public TrustStoreFluent() {
}
public TrustStoreFluent(TrustStore instance) {
this.copyInstance(instance);
}
private String storeFile;
private VisitableBuilder extends PasswordProvider,?> storePasswordProvider;
private String storeType;
protected void copyInstance(TrustStore instance) {
if (instance != null) {
this.withStoreFile(instance.storeFile());
this.withStorePasswordProvider(instance.storePasswordProvider());
this.withStoreType(instance.storeType());
}
}
public String getStoreFile() {
return this.storeFile;
}
public A withStoreFile(String storeFile) {
this.storeFile = storeFile;
return (A) this;
}
public boolean hasStoreFile() {
return this.storeFile != null;
}
public PasswordProvider buildStorePasswordProvider() {
return this.storePasswordProvider != null ? this.storePasswordProvider.build() : null;
}
public A withStorePasswordProvider(PasswordProvider storePasswordProvider) {
if (storePasswordProvider == null) {
this.storePasswordProvider = null;
this._visitables.remove("storePasswordProvider");
return (A) this;
} else {
VisitableBuilder extends PasswordProvider,?> builder = builder(storePasswordProvider);;
this._visitables.get("storePasswordProvider").clear();
this._visitables.get("storePasswordProvider").add(builder);
this.storePasswordProvider = builder;
return (A) this;
}
}
public boolean hasStorePasswordProvider() {
return this.storePasswordProvider != null;
}
public InlinePasswordStoreProviderNested withNewInlinePasswordStoreProvider() {
return new InlinePasswordStoreProviderNested(null);
}
public InlinePasswordStoreProviderNested withNewInlinePasswordStoreProviderLike(InlinePassword item) {
return new InlinePasswordStoreProviderNested(item);
}
public A withNewInlinePasswordStoreProvider(String password) {
return (A)withStorePasswordProvider(new InlinePassword(password));
}
public FilePasswordStoreProviderNested withNewFilePasswordStoreProvider() {
return new FilePasswordStoreProviderNested(null);
}
public FilePasswordStoreProviderNested withNewFilePasswordStoreProviderLike(FilePassword item) {
return new FilePasswordStoreProviderNested(item);
}
public A withNewFilePasswordStoreProvider(String passwordFile) {
return (A)withStorePasswordProvider(new FilePassword(passwordFile));
}
public String getStoreType() {
return this.storeType;
}
public A withStoreType(String storeType) {
this.storeType = storeType;
return (A) this;
}
public boolean hasStoreType() {
return this.storeType != null;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
TrustStoreFluent that = (TrustStoreFluent) o;
if (!java.util.Objects.equals(storeFile, that.storeFile)) return false;
if (!java.util.Objects.equals(storePasswordProvider, that.storePasswordProvider)) return false;
if (!java.util.Objects.equals(storeType, that.storeType)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(storeFile, storePasswordProvider, storeType, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (storeFile != null) { sb.append("storeFile:"); sb.append(storeFile + ","); }
if (storePasswordProvider != null) { sb.append("storePasswordProvider:"); sb.append(storePasswordProvider + ","); }
if (storeType != null) { sb.append("storeType:"); sb.append(storeType); }
sb.append("}");
return sb.toString();
}
protected static VisitableBuilder builder(Object item) {
switch (item.getClass().getName()) {
case "io.kroxylicious.proxy.config.secret."+"InlinePassword": return (VisitableBuilder)new InlinePasswordBuilder((InlinePassword) item);
case "io.kroxylicious.proxy.config.secret."+"FilePassword": return (VisitableBuilder)new FilePasswordBuilder((FilePassword) item);
}
return (VisitableBuilder)builderOf(item);
}
public class InlinePasswordStoreProviderNested extends InlinePasswordFluent> implements Nested{
InlinePasswordStoreProviderNested(InlinePassword item) {
this.builder = new InlinePasswordBuilder(this, item);
}
InlinePasswordBuilder builder;
public N and() {
return (N) TrustStoreFluent.this.withStorePasswordProvider(builder.build());
}
public N endInlinePasswordStoreProvider() {
return and();
}
}
public class FilePasswordStoreProviderNested extends FilePasswordFluent> implements Nested{
FilePasswordStoreProviderNested(FilePassword item) {
this.builder = new FilePasswordBuilder(this, item);
}
FilePasswordBuilder builder;
public N and() {
return (N) TrustStoreFluent.this.withStorePasswordProvider(builder.build());
}
public N endFilePasswordStoreProvider() {
return and();
}
}
}