org.cloudfoundry.uaa.groups.DeleteGroupRequest Maven / Gradle / Ivy
package org.cloudfoundry.uaa.groups;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.cloudfoundry.uaa.IdentityZoned;
import org.cloudfoundry.uaa.Versioned;
import org.immutables.value.Generated;
/**
* The request payload for the delete group
*/
@Generated(from = "_DeleteGroupRequest", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class DeleteGroupRequest extends org.cloudfoundry.uaa.groups._DeleteGroupRequest {
private final @Nullable String version;
private final @Nullable String identityZoneId;
private final @Nullable String identityZoneSubdomain;
private final String groupId;
private DeleteGroupRequest(DeleteGroupRequest.Builder builder) {
this.version = builder.version;
this.identityZoneId = builder.identityZoneId;
this.identityZoneSubdomain = builder.identityZoneSubdomain;
this.groupId = builder.groupId;
}
/**
* Returns the version
*/
@Override
public @Nullable String getVersion() {
return version;
}
/**
* Returns the identity zone id
* @return the identity zone id
*/
@Override
public @Nullable String getIdentityZoneId() {
return identityZoneId;
}
/**
* Returns the identity zone subdomain
* @return the identity zone subdomain
*/
@Override
public @Nullable String getIdentityZoneSubdomain() {
return identityZoneSubdomain;
}
/**
* The group id
*/
@Override
public String getGroupId() {
return groupId;
}
/**
* This instance is equal to all instances of {@code DeleteGroupRequest} 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 DeleteGroupRequest
&& equalTo(0, (DeleteGroupRequest) another);
}
private boolean equalTo(int synthetic, DeleteGroupRequest another) {
return Objects.equals(version, another.version)
&& Objects.equals(identityZoneId, another.identityZoneId)
&& Objects.equals(identityZoneSubdomain, another.identityZoneSubdomain)
&& groupId.equals(another.groupId);
}
/**
* Computes a hash code from attributes: {@code version}, {@code identityZoneId}, {@code identityZoneSubdomain}, {@code groupId}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(version);
h += (h << 5) + Objects.hashCode(identityZoneId);
h += (h << 5) + Objects.hashCode(identityZoneSubdomain);
h += (h << 5) + groupId.hashCode();
return h;
}
/**
* Prints the immutable value {@code DeleteGroupRequest} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "DeleteGroupRequest{"
+ "version=" + version
+ ", identityZoneId=" + identityZoneId
+ ", identityZoneSubdomain=" + identityZoneSubdomain
+ ", groupId=" + groupId
+ "}";
}
/**
* Creates a builder for {@link DeleteGroupRequest DeleteGroupRequest}.
*
* DeleteGroupRequest.builder()
* .version(String | null) // nullable {@link DeleteGroupRequest#getVersion() version}
* .identityZoneId(String | null) // nullable {@link DeleteGroupRequest#getIdentityZoneId() identityZoneId}
* .identityZoneSubdomain(String | null) // nullable {@link DeleteGroupRequest#getIdentityZoneSubdomain() identityZoneSubdomain}
* .groupId(String) // required {@link DeleteGroupRequest#getGroupId() groupId}
* .build();
*
* @return A new DeleteGroupRequest builder
*/
public static DeleteGroupRequest.Builder builder() {
return new DeleteGroupRequest.Builder();
}
/**
* Builds instances of type {@link DeleteGroupRequest DeleteGroupRequest}.
* 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 = "_DeleteGroupRequest", generator = "Immutables")
public static final class Builder {
private static final long INIT_BIT_GROUP_ID = 0x1L;
private long initBits = 0x1L;
private String version;
private String identityZoneId;
private String identityZoneSubdomain;
private String groupId;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code DeleteGroupRequest} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(DeleteGroupRequest instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Copy abstract value type {@code _DeleteGroupRequest} 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(_DeleteGroupRequest instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.uaa.Versioned} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(Versioned instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* 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;
}
private void from(short _unused, Object object) {
long bits = 0;
if (object instanceof org.cloudfoundry.uaa.groups._DeleteGroupRequest) {
org.cloudfoundry.uaa.groups._DeleteGroupRequest instance = (org.cloudfoundry.uaa.groups._DeleteGroupRequest) object;
if ((bits & 0x2L) == 0) {
String identityZoneSubdomainValue = instance.getIdentityZoneSubdomain();
if (identityZoneSubdomainValue != null) {
identityZoneSubdomain(identityZoneSubdomainValue);
}
bits |= 0x2L;
}
if ((bits & 0x1L) == 0) {
String versionValue = instance.getVersion();
if (versionValue != null) {
version(versionValue);
}
bits |= 0x1L;
}
if ((bits & 0x4L) == 0) {
String identityZoneIdValue = instance.getIdentityZoneId();
if (identityZoneIdValue != null) {
identityZoneId(identityZoneIdValue);
}
bits |= 0x4L;
}
groupId(instance.getGroupId());
}
if (object instanceof Versioned) {
Versioned instance = (Versioned) object;
if ((bits & 0x1L) == 0) {
String versionValue = instance.getVersion();
if (versionValue != null) {
version(versionValue);
}
bits |= 0x1L;
}
}
if (object instanceof IdentityZoned) {
IdentityZoned instance = (IdentityZoned) object;
if ((bits & 0x2L) == 0) {
String identityZoneSubdomainValue = instance.getIdentityZoneSubdomain();
if (identityZoneSubdomainValue != null) {
identityZoneSubdomain(identityZoneSubdomainValue);
}
bits |= 0x2L;
}
if ((bits & 0x4L) == 0) {
String identityZoneIdValue = instance.getIdentityZoneId();
if (identityZoneIdValue != null) {
identityZoneId(identityZoneIdValue);
}
bits |= 0x4L;
}
}
}
/**
* Initializes the value for the {@link DeleteGroupRequest#getVersion() version} attribute.
* @param version The value for version (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder version(@Nullable String version) {
this.version = version;
return this;
}
/**
* Initializes the value for the {@link DeleteGroupRequest#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 DeleteGroupRequest#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 DeleteGroupRequest#getGroupId() groupId} attribute.
* @param groupId The value for groupId
* @return {@code this} builder for use in a chained invocation
*/
public final Builder groupId(String groupId) {
this.groupId = Objects.requireNonNull(groupId, "groupId");
initBits &= ~INIT_BIT_GROUP_ID;
return this;
}
/**
* Builds a new {@link DeleteGroupRequest DeleteGroupRequest}.
* @return An immutable instance of DeleteGroupRequest
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public DeleteGroupRequest build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new DeleteGroupRequest(this);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_GROUP_ID) != 0) attributes.add("groupId");
return "Cannot build DeleteGroupRequest, some of required attributes are not set " + attributes;
}
}
}