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

org.cloudfoundry.uaa.users.ChangeUserPasswordRequest Maven / Gradle / Ivy

The newest version!
package org.cloudfoundry.uaa.users;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.cloudfoundry.uaa.IdentityZoned;
import org.immutables.value.Generated;

/**
 * The request payload for the change user password operation
 */
@Generated(from = "_ChangeUserPasswordRequest", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class ChangeUserPasswordRequest extends org.cloudfoundry.uaa.users._ChangeUserPasswordRequest {
  private final @Nullable String identityZoneId;
  private final @Nullable String identityZoneSubdomain;
  private final @Nullable String oldPassword;
  private final String password;
  private final String userId;

  private ChangeUserPasswordRequest(ChangeUserPasswordRequest.Builder builder) {
    this.identityZoneId = builder.identityZoneId;
    this.identityZoneSubdomain = builder.identityZoneSubdomain;
    this.oldPassword = builder.oldPassword;
    this.password = builder.password;
    this.userId = builder.userId;
  }

  /**
   * Returns the identity zone id
   * @return the identity zone id
   */
  @JsonProperty("identityZoneId")
  @JsonIgnore
  @Override
  public @Nullable String getIdentityZoneId() {
    return identityZoneId;
  }

  /**
   * Returns the identity zone subdomain
   * @return the identity zone subdomain
   */
  @JsonProperty("identityZoneSubdomain")
  @JsonIgnore
  @Override
  public @Nullable String getIdentityZoneSubdomain() {
    return identityZoneSubdomain;
  }

  /**
   * The user's existing password
   */
  @JsonProperty("oldPassword")
  @Override
  public @Nullable String getOldPassword() {
    return oldPassword;
  }

  /**
   * The user's desired password
   */
  @JsonProperty("password")
  @Override
  public String getPassword() {
    return password;
  }

  /**
   * The user id
   */
  @JsonProperty("userId")
  @JsonIgnore
  @Override
  public String getUserId() {
    return userId;
  }

  /**
   * This instance is equal to all instances of {@code ChangeUserPasswordRequest} 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 ChangeUserPasswordRequest
        && equalTo(0, (ChangeUserPasswordRequest) another);
  }

  private boolean equalTo(int synthetic, ChangeUserPasswordRequest another) {
    return Objects.equals(identityZoneId, another.identityZoneId)
        && Objects.equals(identityZoneSubdomain, another.identityZoneSubdomain)
        && Objects.equals(oldPassword, another.oldPassword)
        && password.equals(another.password)
        && userId.equals(another.userId);
  }

  /**
   * Computes a hash code from attributes: {@code identityZoneId}, {@code identityZoneSubdomain}, {@code oldPassword}, {@code password}, {@code userId}.
   * @return hashCode value
   */
  @Override
  public int hashCode() {
    int h = 5381;
    h += (h << 5) + Objects.hashCode(identityZoneId);
    h += (h << 5) + Objects.hashCode(identityZoneSubdomain);
    h += (h << 5) + Objects.hashCode(oldPassword);
    h += (h << 5) + password.hashCode();
    h += (h << 5) + userId.hashCode();
    return h;
  }

  /**
   * Prints the immutable value {@code ChangeUserPasswordRequest} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "ChangeUserPasswordRequest{"
        + "identityZoneId=" + identityZoneId
        + ", identityZoneSubdomain=" + identityZoneSubdomain
        + ", oldPassword=" + oldPassword
        + ", password=" + password
        + ", userId=" + userId
        + "}";
  }

  /**
   * 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 = "_ChangeUserPasswordRequest", generator = "Immutables")
  @Deprecated
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
  static final class Json extends org.cloudfoundry.uaa.users._ChangeUserPasswordRequest {
    String identityZoneId;
    String identityZoneSubdomain;
    String oldPassword;
    String password;
    String userId;
    @JsonProperty("identityZoneId")
    @JsonIgnore
    public void setIdentityZoneId(@Nullable String identityZoneId) {
      this.identityZoneId = identityZoneId;
    }
    @JsonProperty("identityZoneSubdomain")
    @JsonIgnore
    public void setIdentityZoneSubdomain(@Nullable String identityZoneSubdomain) {
      this.identityZoneSubdomain = identityZoneSubdomain;
    }
    @JsonProperty("oldPassword")
    public void setOldPassword(@Nullable String oldPassword) {
      this.oldPassword = oldPassword;
    }
    @JsonProperty("password")
    public void setPassword(String password) {
      this.password = password;
    }
    @JsonProperty("userId")
    @JsonIgnore
    public void setUserId(String userId) {
      this.userId = userId;
    }
    @Override
    public String getIdentityZoneId() { throw new UnsupportedOperationException(); }
    @Override
    public String getIdentityZoneSubdomain() { throw new UnsupportedOperationException(); }
    @Override
    public String getOldPassword() { throw new UnsupportedOperationException(); }
    @Override
    public String getPassword() { throw new UnsupportedOperationException(); }
    @Override
    public String getUserId() { 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 ChangeUserPasswordRequest fromJson(Json json) {
    ChangeUserPasswordRequest.Builder builder = ChangeUserPasswordRequest.builder();
    if (json.identityZoneId != null) {
      builder.identityZoneId(json.identityZoneId);
    }
    if (json.identityZoneSubdomain != null) {
      builder.identityZoneSubdomain(json.identityZoneSubdomain);
    }
    if (json.oldPassword != null) {
      builder.oldPassword(json.oldPassword);
    }
    if (json.password != null) {
      builder.password(json.password);
    }
    if (json.userId != null) {
      builder.userId(json.userId);
    }
    return builder.build();
  }

  /**
   * Creates a builder for {@link ChangeUserPasswordRequest ChangeUserPasswordRequest}.
   * 
   * ChangeUserPasswordRequest.builder()
   *    .identityZoneId(String | null) // nullable {@link ChangeUserPasswordRequest#getIdentityZoneId() identityZoneId}
   *    .identityZoneSubdomain(String | null) // nullable {@link ChangeUserPasswordRequest#getIdentityZoneSubdomain() identityZoneSubdomain}
   *    .oldPassword(String | null) // nullable {@link ChangeUserPasswordRequest#getOldPassword() oldPassword}
   *    .password(String) // required {@link ChangeUserPasswordRequest#getPassword() password}
   *    .userId(String) // required {@link ChangeUserPasswordRequest#getUserId() userId}
   *    .build();
   * 
* @return A new ChangeUserPasswordRequest builder */ public static ChangeUserPasswordRequest.Builder builder() { return new ChangeUserPasswordRequest.Builder(); } /** * Builds instances of type {@link ChangeUserPasswordRequest ChangeUserPasswordRequest}. * 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 = "_ChangeUserPasswordRequest", generator = "Immutables") public static final class Builder { private static final long INIT_BIT_PASSWORD = 0x1L; private static final long INIT_BIT_USER_ID = 0x2L; private long initBits = 0x3L; private String identityZoneId; private String identityZoneSubdomain; private String oldPassword; private String password; private String userId; private Builder() { } /** * Fill a builder with attribute values from the provided {@code org.cloudfoundry.uaa.IdentityZoned} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(IdentityZoned instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code ChangeUserPasswordRequest} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(ChangeUserPasswordRequest instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Copy abstract value type {@code _ChangeUserPasswordRequest} instance into builder. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(_ChangeUserPasswordRequest instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } private void from(short _unused, Object object) { if (object instanceof IdentityZoned) { IdentityZoned instance = (IdentityZoned) object; String identityZoneSubdomainValue = instance.getIdentityZoneSubdomain(); if (identityZoneSubdomainValue != null) { identityZoneSubdomain(identityZoneSubdomainValue); } String identityZoneIdValue = instance.getIdentityZoneId(); if (identityZoneIdValue != null) { identityZoneId(identityZoneIdValue); } } if (object instanceof org.cloudfoundry.uaa.users._ChangeUserPasswordRequest) { org.cloudfoundry.uaa.users._ChangeUserPasswordRequest instance = (org.cloudfoundry.uaa.users._ChangeUserPasswordRequest) object; userId(instance.getUserId()); String oldPasswordValue = instance.getOldPassword(); if (oldPasswordValue != null) { oldPassword(oldPasswordValue); } password(instance.getPassword()); } } /** * Initializes the value for the {@link ChangeUserPasswordRequest#getIdentityZoneId() identityZoneId} attribute. * @param identityZoneId The value for identityZoneId (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ public final Builder identityZoneId(@Nullable String identityZoneId) { this.identityZoneId = identityZoneId; return this; } /** * Initializes the value for the {@link ChangeUserPasswordRequest#getIdentityZoneSubdomain() identityZoneSubdomain} attribute. * @param identityZoneSubdomain The value for identityZoneSubdomain (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ public final Builder identityZoneSubdomain(@Nullable String identityZoneSubdomain) { this.identityZoneSubdomain = identityZoneSubdomain; return this; } /** * Initializes the value for the {@link ChangeUserPasswordRequest#getOldPassword() oldPassword} attribute. * @param oldPassword The value for oldPassword (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ public final Builder oldPassword(@Nullable String oldPassword) { this.oldPassword = oldPassword; return this; } /** * Initializes the value for the {@link ChangeUserPasswordRequest#getPassword() password} attribute. * @param password The value for password * @return {@code this} builder for use in a chained invocation */ public final Builder password(String password) { this.password = Objects.requireNonNull(password, "password"); initBits &= ~INIT_BIT_PASSWORD; return this; } /** * Initializes the value for the {@link ChangeUserPasswordRequest#getUserId() userId} attribute. * @param userId The value for userId * @return {@code this} builder for use in a chained invocation */ public final Builder userId(String userId) { this.userId = Objects.requireNonNull(userId, "userId"); initBits &= ~INIT_BIT_USER_ID; return this; } /** * Builds a new {@link ChangeUserPasswordRequest ChangeUserPasswordRequest}. * @return An immutable instance of ChangeUserPasswordRequest * @throws java.lang.IllegalStateException if any required attributes are missing */ public ChangeUserPasswordRequest build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ChangeUserPasswordRequest(this); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_PASSWORD) != 0) attributes.add("password"); if ((initBits & INIT_BIT_USER_ID) != 0) attributes.add("userId"); return "Cannot build ChangeUserPasswordRequest, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy