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

org.cloudfoundry.uaa.identityzones.IdentityZoneConfiguration Maven / Gradle / Ivy

There is a newer version: 5.12.2.RELEASE
Show newest version
package org.cloudfoundry.uaa.identityzones;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.immutables.value.Generated;

/**
 * The payload for the identity zone configuration
 */
@Generated(from = "_IdentityZoneConfiguration", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class IdentityZoneConfiguration
    extends org.cloudfoundry.uaa.identityzones._IdentityZoneConfiguration {
  private final @Nullable Boolean accountChooserEnabled;
  private final @Nullable Branding branding;
  private final @Nullable ClientLockoutPolicy clientLockoutPolicy;
  private final @Nullable ClientSecretPolicy clientSecretPolicy;
  private final @Nullable CorsPolicy corsPolicy;
  private final @Nullable String issuer;
  private final @Nullable Boolean ldapDiscoveryEnabled;
  private final @Nullable Links links;
  private final @Nullable MfaConfig mfaConfig;
  private final @Nullable List prompts;
  private final @Nullable SamlConfiguration samlConfiguration;
  private final @Nullable TokenPolicy tokenPolicy;
  private final @Nullable UserConfig userConfig;

  private IdentityZoneConfiguration(IdentityZoneConfiguration.Builder builder) {
    this.accountChooserEnabled = builder.accountChooserEnabled;
    this.branding = builder.branding;
    this.clientLockoutPolicy = builder.clientLockoutPolicy;
    this.clientSecretPolicy = builder.clientSecretPolicy;
    this.corsPolicy = builder.corsPolicy;
    this.issuer = builder.issuer;
    this.ldapDiscoveryEnabled = builder.ldapDiscoveryEnabled;
    this.links = builder.links;
    this.mfaConfig = builder.mfaConfig;
    this.prompts = builder.prompts == null ? null : createUnmodifiableList(true, builder.prompts);
    this.samlConfiguration = builder.samlConfiguration;
    this.tokenPolicy = builder.tokenPolicy;
    this.userConfig = builder.userConfig;
  }

  /**
   * This flag is required to enable account choosing functionality for IDP discovery page.
   */
  @JsonProperty("accountChooserEnabled")
  @Override
  public @Nullable Boolean getAccountChooserEnabled() {
    return accountChooserEnabled;
  }

  /**
   * The branding
   */
  @JsonProperty("branding")
  @Override
  public @Nullable Branding getBranding() {
    return branding;
  }

  /**
   * The client lockout policy
   */
  @JsonProperty("clientLockoutPolicy")
  @Override
  public @Nullable ClientLockoutPolicy getClientLockoutPolicy() {
    return clientLockoutPolicy;
  }

  /**
   * The client secret policy
   */
  @JsonProperty("clientSecretPolicy")
  @Override
  public @Nullable ClientSecretPolicy getClientSecretPolicy() {
    return clientSecretPolicy;
  }

  /**
   * The CORS policy
   */
  @JsonProperty("corsPolicy")
  @Override
  public @Nullable CorsPolicy getCorsPolicy() {
    return corsPolicy;
  }

  /**
   * The issuer of this zone
   */
  @JsonProperty("issuer")
  @Override
  public @Nullable String getIssuer() {
    return issuer;
  }

  /**
   * IDP Discovery should be set to true if you have configured more than one identity provider for UAA. The discovery relies on email domain being set for each additional provider.
   */
  @JsonProperty("idpDiscoveryEnabled")
  @Override
  public @Nullable Boolean getLdapDiscoveryEnabled() {
    return ldapDiscoveryEnabled;
  }

  /**
   * The links
   */
  @JsonProperty("links")
  @Override
  public @Nullable Links getLinks() {
    return links;
  }

  /**
   * The Multi-factor Authentication configuration
   */
  @JsonProperty("mfaConfig")
  @Override
  public @Nullable MfaConfig getMfaConfig() {
    return mfaConfig;
  }

  /**
   * The prompts
   */
  @JsonProperty("prompts")
  @Override
  public @Nullable List getPrompts() {
    return prompts;
  }

  /**
   * The saml configuration
   */
  @JsonProperty("samlConfig")
  @Override
  public @Nullable SamlConfiguration getSamlConfiguration() {
    return samlConfiguration;
  }

  /**
   * The token policy
   */
  @JsonProperty("tokenPolicy")
  @Override
  public @Nullable TokenPolicy getTokenPolicy() {
    return tokenPolicy;
  }

  /**
   * The user configuration
   */
  @JsonProperty("userConfig")
  @Override
  public @Nullable UserConfig getUserConfig() {
    return userConfig;
  }

  /**
   * This instance is equal to all instances of {@code IdentityZoneConfiguration} that have equal attribute values.
   * @return {@code true} if {@code this} is equal to {@code another} instance
   */
  @Override
  public boolean equals(Object another) {
    if (this == another) return true;
    return another instanceof IdentityZoneConfiguration
        && equalTo(0, (IdentityZoneConfiguration) another);
  }

  private boolean equalTo(int synthetic, IdentityZoneConfiguration another) {
    return Objects.equals(accountChooserEnabled, another.accountChooserEnabled)
        && Objects.equals(branding, another.branding)
        && Objects.equals(clientLockoutPolicy, another.clientLockoutPolicy)
        && Objects.equals(clientSecretPolicy, another.clientSecretPolicy)
        && Objects.equals(corsPolicy, another.corsPolicy)
        && Objects.equals(issuer, another.issuer)
        && Objects.equals(ldapDiscoveryEnabled, another.ldapDiscoveryEnabled)
        && Objects.equals(links, another.links)
        && Objects.equals(mfaConfig, another.mfaConfig)
        && Objects.equals(prompts, another.prompts)
        && Objects.equals(samlConfiguration, another.samlConfiguration)
        && Objects.equals(tokenPolicy, another.tokenPolicy)
        && Objects.equals(userConfig, another.userConfig);
  }

  /**
   * Computes a hash code from attributes: {@code accountChooserEnabled}, {@code branding}, {@code clientLockoutPolicy}, {@code clientSecretPolicy}, {@code corsPolicy}, {@code issuer}, {@code ldapDiscoveryEnabled}, {@code links}, {@code mfaConfig}, {@code prompts}, {@code samlConfiguration}, {@code tokenPolicy}, {@code userConfig}.
   * @return hashCode value
   */
  @Override
  public int hashCode() {
    int h = 5381;
    h += (h << 5) + Objects.hashCode(accountChooserEnabled);
    h += (h << 5) + Objects.hashCode(branding);
    h += (h << 5) + Objects.hashCode(clientLockoutPolicy);
    h += (h << 5) + Objects.hashCode(clientSecretPolicy);
    h += (h << 5) + Objects.hashCode(corsPolicy);
    h += (h << 5) + Objects.hashCode(issuer);
    h += (h << 5) + Objects.hashCode(ldapDiscoveryEnabled);
    h += (h << 5) + Objects.hashCode(links);
    h += (h << 5) + Objects.hashCode(mfaConfig);
    h += (h << 5) + Objects.hashCode(prompts);
    h += (h << 5) + Objects.hashCode(samlConfiguration);
    h += (h << 5) + Objects.hashCode(tokenPolicy);
    h += (h << 5) + Objects.hashCode(userConfig);
    return h;
  }

  /**
   * Prints the immutable value {@code IdentityZoneConfiguration} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "IdentityZoneConfiguration{"
        + "accountChooserEnabled=" + accountChooserEnabled
        + ", branding=" + branding
        + ", clientLockoutPolicy=" + clientLockoutPolicy
        + ", clientSecretPolicy=" + clientSecretPolicy
        + ", corsPolicy=" + corsPolicy
        + ", issuer=" + issuer
        + ", ldapDiscoveryEnabled=" + ldapDiscoveryEnabled
        + ", links=" + links
        + ", mfaConfig=" + mfaConfig
        + ", prompts=" + prompts
        + ", samlConfiguration=" + samlConfiguration
        + ", tokenPolicy=" + tokenPolicy
        + ", userConfig=" + userConfig
        + "}";
  }

  /**
   * Utility type used to correctly read immutable object from JSON representation.
   * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure
   */
  @Generated(from = "_IdentityZoneConfiguration", generator = "Immutables")
  @Deprecated
  @JsonDeserialize
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
  static final class Json extends org.cloudfoundry.uaa.identityzones._IdentityZoneConfiguration {
    Boolean accountChooserEnabled;
    Branding branding;
    ClientLockoutPolicy clientLockoutPolicy;
    ClientSecretPolicy clientSecretPolicy;
    CorsPolicy corsPolicy;
    String issuer;
    Boolean ldapDiscoveryEnabled;
    Links links;
    MfaConfig mfaConfig;
    List prompts = null;
    SamlConfiguration samlConfiguration;
    TokenPolicy tokenPolicy;
    UserConfig userConfig;
    @JsonProperty("accountChooserEnabled")
    public void setAccountChooserEnabled(@Nullable Boolean accountChooserEnabled) {
      this.accountChooserEnabled = accountChooserEnabled;
    }
    @JsonProperty("branding")
    public void setBranding(@Nullable Branding branding) {
      this.branding = branding;
    }
    @JsonProperty("clientLockoutPolicy")
    public void setClientLockoutPolicy(@Nullable ClientLockoutPolicy clientLockoutPolicy) {
      this.clientLockoutPolicy = clientLockoutPolicy;
    }
    @JsonProperty("clientSecretPolicy")
    public void setClientSecretPolicy(@Nullable ClientSecretPolicy clientSecretPolicy) {
      this.clientSecretPolicy = clientSecretPolicy;
    }
    @JsonProperty("corsPolicy")
    public void setCorsPolicy(@Nullable CorsPolicy corsPolicy) {
      this.corsPolicy = corsPolicy;
    }
    @JsonProperty("issuer")
    public void setIssuer(@Nullable String issuer) {
      this.issuer = issuer;
    }
    @JsonProperty("idpDiscoveryEnabled")
    public void setLdapDiscoveryEnabled(@Nullable Boolean ldapDiscoveryEnabled) {
      this.ldapDiscoveryEnabled = ldapDiscoveryEnabled;
    }
    @JsonProperty("links")
    public void setLinks(@Nullable Links links) {
      this.links = links;
    }
    @JsonProperty("mfaConfig")
    public void setMfaConfig(@Nullable MfaConfig mfaConfig) {
      this.mfaConfig = mfaConfig;
    }
    @JsonProperty("prompts")
    public void setPrompts(@Nullable List prompts) {
      this.prompts = prompts;
    }
    @JsonProperty("samlConfig")
    public void setSamlConfiguration(@Nullable SamlConfiguration samlConfiguration) {
      this.samlConfiguration = samlConfiguration;
    }
    @JsonProperty("tokenPolicy")
    public void setTokenPolicy(@Nullable TokenPolicy tokenPolicy) {
      this.tokenPolicy = tokenPolicy;
    }
    @JsonProperty("userConfig")
    public void setUserConfig(@Nullable UserConfig userConfig) {
      this.userConfig = userConfig;
    }
    @Override
    public Boolean getAccountChooserEnabled() { throw new UnsupportedOperationException(); }
    @Override
    public Branding getBranding() { throw new UnsupportedOperationException(); }
    @Override
    public ClientLockoutPolicy getClientLockoutPolicy() { throw new UnsupportedOperationException(); }
    @Override
    public ClientSecretPolicy getClientSecretPolicy() { throw new UnsupportedOperationException(); }
    @Override
    public CorsPolicy getCorsPolicy() { throw new UnsupportedOperationException(); }
    @Override
    public String getIssuer() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getLdapDiscoveryEnabled() { throw new UnsupportedOperationException(); }
    @Override
    public Links getLinks() { throw new UnsupportedOperationException(); }
    @Override
    public MfaConfig getMfaConfig() { throw new UnsupportedOperationException(); }
    @Override
    public List getPrompts() { throw new UnsupportedOperationException(); }
    @Override
    public SamlConfiguration getSamlConfiguration() { throw new UnsupportedOperationException(); }
    @Override
    public TokenPolicy getTokenPolicy() { throw new UnsupportedOperationException(); }
    @Override
    public UserConfig getUserConfig() { throw new UnsupportedOperationException(); }
  }

  /**
   * @param json A JSON-bindable data structure
   * @return An immutable value type
   * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure
   */
  @Deprecated
  @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
  static IdentityZoneConfiguration fromJson(Json json) {
    IdentityZoneConfiguration.Builder builder = IdentityZoneConfiguration.builder();
    if (json.accountChooserEnabled != null) {
      builder.accountChooserEnabled(json.accountChooserEnabled);
    }
    if (json.branding != null) {
      builder.branding(json.branding);
    }
    if (json.clientLockoutPolicy != null) {
      builder.clientLockoutPolicy(json.clientLockoutPolicy);
    }
    if (json.clientSecretPolicy != null) {
      builder.clientSecretPolicy(json.clientSecretPolicy);
    }
    if (json.corsPolicy != null) {
      builder.corsPolicy(json.corsPolicy);
    }
    if (json.issuer != null) {
      builder.issuer(json.issuer);
    }
    if (json.ldapDiscoveryEnabled != null) {
      builder.ldapDiscoveryEnabled(json.ldapDiscoveryEnabled);
    }
    if (json.links != null) {
      builder.links(json.links);
    }
    if (json.mfaConfig != null) {
      builder.mfaConfig(json.mfaConfig);
    }
    if (json.prompts != null) {
      builder.addAllPrompts(json.prompts);
    }
    if (json.samlConfiguration != null) {
      builder.samlConfiguration(json.samlConfiguration);
    }
    if (json.tokenPolicy != null) {
      builder.tokenPolicy(json.tokenPolicy);
    }
    if (json.userConfig != null) {
      builder.userConfig(json.userConfig);
    }
    return builder.build();
  }

  /**
   * Creates a builder for {@link IdentityZoneConfiguration IdentityZoneConfiguration}.
   * 
   * IdentityZoneConfiguration.builder()
   *    .accountChooserEnabled(Boolean | null) // nullable {@link IdentityZoneConfiguration#getAccountChooserEnabled() accountChooserEnabled}
   *    .branding(org.cloudfoundry.uaa.identityzones.Branding | null) // nullable {@link IdentityZoneConfiguration#getBranding() branding}
   *    .clientLockoutPolicy(org.cloudfoundry.uaa.identityzones.ClientLockoutPolicy | null) // nullable {@link IdentityZoneConfiguration#getClientLockoutPolicy() clientLockoutPolicy}
   *    .clientSecretPolicy(org.cloudfoundry.uaa.identityzones.ClientSecretPolicy | null) // nullable {@link IdentityZoneConfiguration#getClientSecretPolicy() clientSecretPolicy}
   *    .corsPolicy(org.cloudfoundry.uaa.identityzones.CorsPolicy | null) // nullable {@link IdentityZoneConfiguration#getCorsPolicy() corsPolicy}
   *    .issuer(String | null) // nullable {@link IdentityZoneConfiguration#getIssuer() issuer}
   *    .ldapDiscoveryEnabled(Boolean | null) // nullable {@link IdentityZoneConfiguration#getLdapDiscoveryEnabled() ldapDiscoveryEnabled}
   *    .links(org.cloudfoundry.uaa.identityzones.Links | null) // nullable {@link IdentityZoneConfiguration#getLinks() links}
   *    .mfaConfig(org.cloudfoundry.uaa.identityzones.MfaConfig | null) // nullable {@link IdentityZoneConfiguration#getMfaConfig() mfaConfig}
   *    .prompts(List&lt;Prompt&gt; | null) // nullable {@link IdentityZoneConfiguration#getPrompts() prompts}
   *    .samlConfiguration(org.cloudfoundry.uaa.identityzones.SamlConfiguration | null) // nullable {@link IdentityZoneConfiguration#getSamlConfiguration() samlConfiguration}
   *    .tokenPolicy(org.cloudfoundry.uaa.identityzones.TokenPolicy | null) // nullable {@link IdentityZoneConfiguration#getTokenPolicy() tokenPolicy}
   *    .userConfig(org.cloudfoundry.uaa.identityzones.UserConfig | null) // nullable {@link IdentityZoneConfiguration#getUserConfig() userConfig}
   *    .build();
   * 
* @return A new IdentityZoneConfiguration builder */ public static IdentityZoneConfiguration.Builder builder() { return new IdentityZoneConfiguration.Builder(); } /** * Builds instances of type {@link IdentityZoneConfiguration IdentityZoneConfiguration}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "_IdentityZoneConfiguration", generator = "Immutables") public static final class Builder { private Boolean accountChooserEnabled; private Branding branding; private ClientLockoutPolicy clientLockoutPolicy; private ClientSecretPolicy clientSecretPolicy; private CorsPolicy corsPolicy; private String issuer; private Boolean ldapDiscoveryEnabled; private Links links; private MfaConfig mfaConfig; private List prompts = null; private SamlConfiguration samlConfiguration; private TokenPolicy tokenPolicy; private UserConfig userConfig; private Builder() { } /** * Fill a builder with attribute values from the provided {@code IdentityZoneConfiguration} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(IdentityZoneConfiguration instance) { return from((_IdentityZoneConfiguration) instance); } /** * Copy abstract value type {@code _IdentityZoneConfiguration} instance into builder. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ final Builder from(_IdentityZoneConfiguration instance) { Objects.requireNonNull(instance, "instance"); Boolean accountChooserEnabledValue = instance.getAccountChooserEnabled(); if (accountChooserEnabledValue != null) { accountChooserEnabled(accountChooserEnabledValue); } Branding brandingValue = instance.getBranding(); if (brandingValue != null) { branding(brandingValue); } ClientLockoutPolicy clientLockoutPolicyValue = instance.getClientLockoutPolicy(); if (clientLockoutPolicyValue != null) { clientLockoutPolicy(clientLockoutPolicyValue); } ClientSecretPolicy clientSecretPolicyValue = instance.getClientSecretPolicy(); if (clientSecretPolicyValue != null) { clientSecretPolicy(clientSecretPolicyValue); } CorsPolicy corsPolicyValue = instance.getCorsPolicy(); if (corsPolicyValue != null) { corsPolicy(corsPolicyValue); } String issuerValue = instance.getIssuer(); if (issuerValue != null) { issuer(issuerValue); } Boolean ldapDiscoveryEnabledValue = instance.getLdapDiscoveryEnabled(); if (ldapDiscoveryEnabledValue != null) { ldapDiscoveryEnabled(ldapDiscoveryEnabledValue); } Links linksValue = instance.getLinks(); if (linksValue != null) { links(linksValue); } MfaConfig mfaConfigValue = instance.getMfaConfig(); if (mfaConfigValue != null) { mfaConfig(mfaConfigValue); } List promptsValue = instance.getPrompts(); if (promptsValue != null) { addAllPrompts(promptsValue); } SamlConfiguration samlConfigurationValue = instance.getSamlConfiguration(); if (samlConfigurationValue != null) { samlConfiguration(samlConfigurationValue); } TokenPolicy tokenPolicyValue = instance.getTokenPolicy(); if (tokenPolicyValue != null) { tokenPolicy(tokenPolicyValue); } UserConfig userConfigValue = instance.getUserConfig(); if (userConfigValue != null) { userConfig(userConfigValue); } return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getAccountChooserEnabled() accountChooserEnabled} attribute. * @param accountChooserEnabled The value for accountChooserEnabled (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("accountChooserEnabled") public final Builder accountChooserEnabled(@Nullable Boolean accountChooserEnabled) { this.accountChooserEnabled = accountChooserEnabled; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getBranding() branding} attribute. * @param branding The value for branding (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("branding") public final Builder branding(@Nullable Branding branding) { this.branding = branding; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getClientLockoutPolicy() clientLockoutPolicy} attribute. * @param clientLockoutPolicy The value for clientLockoutPolicy (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("clientLockoutPolicy") public final Builder clientLockoutPolicy(@Nullable ClientLockoutPolicy clientLockoutPolicy) { this.clientLockoutPolicy = clientLockoutPolicy; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getClientSecretPolicy() clientSecretPolicy} attribute. * @param clientSecretPolicy The value for clientSecretPolicy (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("clientSecretPolicy") public final Builder clientSecretPolicy(@Nullable ClientSecretPolicy clientSecretPolicy) { this.clientSecretPolicy = clientSecretPolicy; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getCorsPolicy() corsPolicy} attribute. * @param corsPolicy The value for corsPolicy (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("corsPolicy") public final Builder corsPolicy(@Nullable CorsPolicy corsPolicy) { this.corsPolicy = corsPolicy; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getIssuer() issuer} attribute. * @param issuer The value for issuer (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("issuer") public final Builder issuer(@Nullable String issuer) { this.issuer = issuer; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getLdapDiscoveryEnabled() ldapDiscoveryEnabled} attribute. * @param ldapDiscoveryEnabled The value for ldapDiscoveryEnabled (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("idpDiscoveryEnabled") public final Builder ldapDiscoveryEnabled(@Nullable Boolean ldapDiscoveryEnabled) { this.ldapDiscoveryEnabled = ldapDiscoveryEnabled; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getLinks() links} attribute. * @param links The value for links (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("links") public final Builder links(@Nullable Links links) { this.links = links; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getMfaConfig() mfaConfig} attribute. * @param mfaConfig The value for mfaConfig (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("mfaConfig") public final Builder mfaConfig(@Nullable MfaConfig mfaConfig) { this.mfaConfig = mfaConfig; return this; } /** * Adds one element to {@link IdentityZoneConfiguration#getPrompts() prompts} list. * @param element A prompts element * @return {@code this} builder for use in a chained invocation */ public final Builder prompt(Prompt element) { if (this.prompts == null) { this.prompts = new ArrayList(); } this.prompts.add(Objects.requireNonNull(element, "prompts element")); return this; } /** * Adds elements to {@link IdentityZoneConfiguration#getPrompts() prompts} list. * @param elements An array of prompts elements * @return {@code this} builder for use in a chained invocation */ public final Builder prompts(Prompt... elements) { if (this.prompts == null) { this.prompts = new ArrayList(); } for (Prompt element : elements) { this.prompts.add(Objects.requireNonNull(element, "prompts element")); } return this; } /** * Sets or replaces all elements for {@link IdentityZoneConfiguration#getPrompts() prompts} list. * @param elements An iterable of prompts elements * @return {@code this} builder for use in a chained invocation */ @JsonProperty("prompts") public final Builder prompts(@Nullable Iterable elements) { if (elements == null) { this.prompts = null; return this; } this.prompts = new ArrayList(); return addAllPrompts(elements); } /** * Adds elements to {@link IdentityZoneConfiguration#getPrompts() prompts} list. * @param elements An iterable of prompts elements * @return {@code this} builder for use in a chained invocation */ public final Builder addAllPrompts(Iterable elements) { Objects.requireNonNull(elements, "prompts element"); if (this.prompts == null) { this.prompts = new ArrayList(); } for (Prompt element : elements) { this.prompts.add(Objects.requireNonNull(element, "prompts element")); } return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getSamlConfiguration() samlConfiguration} attribute. * @param samlConfiguration The value for samlConfiguration (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("samlConfig") public final Builder samlConfiguration(@Nullable SamlConfiguration samlConfiguration) { this.samlConfiguration = samlConfiguration; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getTokenPolicy() tokenPolicy} attribute. * @param tokenPolicy The value for tokenPolicy (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("tokenPolicy") public final Builder tokenPolicy(@Nullable TokenPolicy tokenPolicy) { this.tokenPolicy = tokenPolicy; return this; } /** * Initializes the value for the {@link IdentityZoneConfiguration#getUserConfig() userConfig} attribute. * @param userConfig The value for userConfig (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("userConfig") public final Builder userConfig(@Nullable UserConfig userConfig) { this.userConfig = userConfig; return this; } /** * Builds a new {@link IdentityZoneConfiguration IdentityZoneConfiguration}. * @return An immutable instance of IdentityZoneConfiguration * @throws java.lang.IllegalStateException if any required attributes are missing */ public IdentityZoneConfiguration build() { return new IdentityZoneConfiguration(this); } } private static List createSafeList(Iterable iterable, boolean checkNulls, boolean skipNulls) { ArrayList list; if (iterable instanceof Collection) { int size = ((Collection) iterable).size(); if (size == 0) return Collections.emptyList(); list = new ArrayList<>(size); } else { list = new ArrayList<>(); } for (T element : iterable) { if (skipNulls && element == null) continue; if (checkNulls) Objects.requireNonNull(element, "element"); list.add(element); } return list; } private static List createUnmodifiableList(boolean clone, List list) { switch(list.size()) { case 0: return Collections.emptyList(); case 1: return Collections.singletonList(list.get(0)); default: if (clone) { return Collections.unmodifiableList(new ArrayList<>(list)); } else { if (list instanceof ArrayList) { ((ArrayList) list).trimToSize(); } return Collections.unmodifiableList(list); } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy