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

com.neotys.neoload.model.v3.project.server.ImmutableNegotiateAuthentication Maven / Gradle / Ivy

package com.neotys.neoload.model.v3.project.server;

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 com.google.common.base.MoreObjects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.CheckReturnValue;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;

/**
 * Immutable implementation of {@link NegotiateAuthentication}.
 * 

* Use the builder to create immutable instances: * {@code new NegotiateAuthentication.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "NegotiateAuthentication"}) @Immutable @CheckReturnValue public final class ImmutableNegotiateAuthentication implements NegotiateAuthentication { private final @Nullable String domain; private final String login; private final String password; private ImmutableNegotiateAuthentication( @Nullable String domain, String login, String password) { this.domain = domain; this.login = login; this.password = password; } /** * @return The value of the {@code domain} attribute */ @JsonProperty("domain") @Override public Optional getDomain() { return Optional.ofNullable(domain); } /** * @return The value of the {@code login} attribute */ @JsonProperty("login") @Override public String getLogin() { return login; } /** * @return The value of the {@code password} attribute */ @JsonProperty("password") @Override public String getPassword() { return password; } /** * Copy the current immutable object by setting a present value for the optional {@link NegotiateAuthentication#getDomain() domain} attribute. * @param value The value for domain * @return A modified copy of {@code this} object */ public final ImmutableNegotiateAuthentication withDomain(String value) { @Nullable String newValue = Objects.requireNonNull(value, "domain"); if (Objects.equals(this.domain, newValue)) return this; return new ImmutableNegotiateAuthentication(newValue, this.login, this.password); } /** * Copy the current immutable object by setting an optional value for the {@link NegotiateAuthentication#getDomain() domain} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for domain * @return A modified copy of {@code this} object */ public final ImmutableNegotiateAuthentication withDomain(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.domain, value)) return this; return new ImmutableNegotiateAuthentication(value, this.login, this.password); } /** * Copy the current immutable object by setting a value for the {@link NegotiateAuthentication#getLogin() login} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for login (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableNegotiateAuthentication withLogin(String value) { if (Objects.equals(this.login, value)) return this; return new ImmutableNegotiateAuthentication(this.domain, value, this.password); } /** * Copy the current immutable object by setting a value for the {@link NegotiateAuthentication#getPassword() password} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for password (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableNegotiateAuthentication withPassword(String value) { if (Objects.equals(this.password, value)) return this; return new ImmutableNegotiateAuthentication(this.domain, this.login, value); } /** * This instance is equal to all instances of {@code ImmutableNegotiateAuthentication} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableNegotiateAuthentication && equalTo((ImmutableNegotiateAuthentication) another); } private boolean equalTo(ImmutableNegotiateAuthentication another) { return Objects.equals(domain, another.domain) && Objects.equals(login, another.login) && Objects.equals(password, another.password); } /** * Computes a hash code from attributes: {@code domain}, {@code login}, {@code password}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(domain); h += (h << 5) + Objects.hashCode(login); h += (h << 5) + Objects.hashCode(password); return h; } /** * Prints the immutable value {@code NegotiateAuthentication} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("NegotiateAuthentication") .omitNullValues() .add("domain", domain) .add("login", login) .add("password", password) .toString(); } /** * 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 */ @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements NegotiateAuthentication { Optional domain = Optional.empty(); @Nullable String login; @Nullable String password; @JsonProperty("domain") public void setDomain(Optional domain) { this.domain = domain; } @JsonProperty("login") public void setLogin(String login) { this.login = login; } @JsonProperty("password") public void setPassword(String password) { this.password = password; } @Override public Optional getDomain() { throw new UnsupportedOperationException(); } @Override public String getLogin() { throw new UnsupportedOperationException(); } @Override public String getPassword() { 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 ImmutableNegotiateAuthentication fromJson(Json json) { NegotiateAuthentication.Builder builder = new NegotiateAuthentication.Builder(); if (json.domain != null) { builder.domain(json.domain); } if (json.login != null) { builder.login(json.login); } if (json.password != null) { builder.password(json.password); } return (ImmutableNegotiateAuthentication) builder.build(); } /** * Creates an immutable copy of a {@link NegotiateAuthentication} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable NegotiateAuthentication instance */ public static ImmutableNegotiateAuthentication copyOf(NegotiateAuthentication instance) { if (instance instanceof ImmutableNegotiateAuthentication) { return (ImmutableNegotiateAuthentication) instance; } return new NegotiateAuthentication.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableNegotiateAuthentication ImmutableNegotiateAuthentication}. * 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. */ @NotThreadSafe public static class Builder { private @Nullable String domain; private @Nullable String login; private @Nullable String password; /** * Creates a builder for {@link ImmutableNegotiateAuthentication ImmutableNegotiateAuthentication} instances. */ public Builder() { if (!(this instanceof NegotiateAuthentication.Builder)) { throw new UnsupportedOperationException("Use: new NegotiateAuthentication.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.server.NegotiateAuthentication} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final NegotiateAuthentication.Builder from(NegotiateAuthentication instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (NegotiateAuthentication.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.server.LoginPasswordAuthentication} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final NegotiateAuthentication.Builder from(LoginPasswordAuthentication instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (NegotiateAuthentication.Builder) this; } private void from(Object object) { if (object instanceof NegotiateAuthentication) { NegotiateAuthentication instance = (NegotiateAuthentication) object; Optional domainOptional = instance.getDomain(); if (domainOptional.isPresent()) { domain(domainOptional); } } if (object instanceof LoginPasswordAuthentication) { LoginPasswordAuthentication instance = (LoginPasswordAuthentication) object; String loginValue = instance.getLogin(); if (loginValue != null) { login(loginValue); } String passwordValue = instance.getPassword(); if (passwordValue != null) { password(passwordValue); } } } /** * Initializes the optional value {@link NegotiateAuthentication#getDomain() domain} to domain. * @param domain The value for domain * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final NegotiateAuthentication.Builder domain(String domain) { this.domain = Objects.requireNonNull(domain, "domain"); return (NegotiateAuthentication.Builder) this; } /** * Initializes the optional value {@link NegotiateAuthentication#getDomain() domain} to domain. * @param domain The value for domain * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("domain") public final NegotiateAuthentication.Builder domain(Optional domain) { this.domain = domain.orElse(null); return (NegotiateAuthentication.Builder) this; } /** * Initializes the value for the {@link NegotiateAuthentication#getLogin() login} attribute. * @param login The value for login (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("login") public final NegotiateAuthentication.Builder login(String login) { this.login = login; return (NegotiateAuthentication.Builder) this; } /** * Initializes the value for the {@link NegotiateAuthentication#getPassword() password} attribute. * @param password The value for password (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("password") public final NegotiateAuthentication.Builder password(String password) { this.password = password; return (NegotiateAuthentication.Builder) this; } /** * Builds a new {@link ImmutableNegotiateAuthentication ImmutableNegotiateAuthentication}. * @return An immutable instance of NegotiateAuthentication * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableNegotiateAuthentication build() { return new ImmutableNegotiateAuthentication(domain, login, password); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy