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

org.cloudfoundry.client.lib.domain.ImmutableDropletInfo Maven / Gradle / Ivy

The newest version!
package org.cloudfoundry.client.lib.domain;

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.Objects;
import java.util.UUID;
import org.cloudfoundry.client.lib.domain.annotation.Nullable;
import org.immutables.value.Generated;

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

* Use the builder to create immutable instances: * {@code ImmutableDropletInfo.builder()}. * Use the static factory method to create immutable instances: * {@code ImmutableDropletInfo.of()}. */ @Generated(from = "DropletInfo", generator = "Immutables") @SuppressWarnings({"all"}) @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableDropletInfo implements DropletInfo { private final @Nullable UUID guid; private final @Nullable UUID packageGuid; private ImmutableDropletInfo( @Nullable UUID guid, @Nullable UUID packageGuid) { this.guid = guid; this.packageGuid = packageGuid; } /** * @return The value of the {@code guid} attribute */ @JsonProperty("guid") @Override public @Nullable UUID getGuid() { return guid; } /** * @return The value of the {@code packageGuid} attribute */ @JsonProperty("packageGuid") @Override public @Nullable UUID getPackageGuid() { return packageGuid; } /** * Copy the current immutable object by setting a value for the {@link DropletInfo#getGuid() guid} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for guid (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableDropletInfo withGuid(@Nullable UUID value) { if (this.guid == value) return this; return new ImmutableDropletInfo(value, this.packageGuid); } /** * Copy the current immutable object by setting a value for the {@link DropletInfo#getPackageGuid() packageGuid} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for packageGuid (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableDropletInfo withPackageGuid(@Nullable UUID value) { if (this.packageGuid == value) return this; return new ImmutableDropletInfo(this.guid, value); } /** * This instance is equal to all instances of {@code ImmutableDropletInfo} 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 ImmutableDropletInfo && equalTo((ImmutableDropletInfo) another); } private boolean equalTo(ImmutableDropletInfo another) { return Objects.equals(guid, another.guid) && Objects.equals(packageGuid, another.packageGuid); } /** * Computes a hash code from attributes: {@code guid}, {@code packageGuid}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(guid); h += (h << 5) + Objects.hashCode(packageGuid); return h; } /** * Prints the immutable value {@code DropletInfo} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "DropletInfo{" + "guid=" + guid + ", packageGuid=" + packageGuid + "}"; } /** * 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 = "DropletInfo", generator = "Immutables") @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements DropletInfo { UUID guid; UUID packageGuid; @JsonProperty("guid") public void setGuid(@Nullable UUID guid) { this.guid = guid; } @JsonProperty("packageGuid") public void setPackageGuid(@Nullable UUID packageGuid) { this.packageGuid = packageGuid; } @Override public UUID getGuid() { throw new UnsupportedOperationException(); } @Override public UUID getPackageGuid() { 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 ImmutableDropletInfo fromJson(Json json) { ImmutableDropletInfo.Builder builder = ImmutableDropletInfo.builder(); if (json.guid != null) { builder.guid(json.guid); } if (json.packageGuid != null) { builder.packageGuid(json.packageGuid); } return builder.build(); } /** * Construct a new immutable {@code DropletInfo} instance. * @param guid The value for the {@code guid} attribute * @param packageGuid The value for the {@code packageGuid} attribute * @return An immutable DropletInfo instance */ public static ImmutableDropletInfo of(@Nullable UUID guid, @Nullable UUID packageGuid) { return new ImmutableDropletInfo(guid, packageGuid); } /** * Creates an immutable copy of a {@link DropletInfo} 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 DropletInfo instance */ public static ImmutableDropletInfo copyOf(DropletInfo instance) { if (instance instanceof ImmutableDropletInfo) { return (ImmutableDropletInfo) instance; } return ImmutableDropletInfo.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableDropletInfo ImmutableDropletInfo}. *

   * ImmutableDropletInfo.builder()
   *    .guid(UUID | null) // nullable {@link DropletInfo#getGuid() guid}
   *    .packageGuid(UUID | null) // nullable {@link DropletInfo#getPackageGuid() packageGuid}
   *    .build();
   * 
* @return A new ImmutableDropletInfo builder */ public static ImmutableDropletInfo.Builder builder() { return new ImmutableDropletInfo.Builder(); } /** * Builds instances of type {@link ImmutableDropletInfo ImmutableDropletInfo}. * 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 = "DropletInfo", generator = "Immutables") public static final class Builder { private UUID guid; private UUID packageGuid; private Builder() { } /** * Fill a builder with attribute values from the provided {@code DropletInfo} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(DropletInfo instance) { Objects.requireNonNull(instance, "instance"); @Nullable UUID guidValue = instance.getGuid(); if (guidValue != null) { guid(guidValue); } @Nullable UUID packageGuidValue = instance.getPackageGuid(); if (packageGuidValue != null) { packageGuid(packageGuidValue); } return this; } /** * Initializes the value for the {@link DropletInfo#getGuid() guid} attribute. * @param guid The value for guid (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("guid") public final Builder guid(@Nullable UUID guid) { this.guid = guid; return this; } /** * Initializes the value for the {@link DropletInfo#getPackageGuid() packageGuid} attribute. * @param packageGuid The value for packageGuid (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("packageGuid") public final Builder packageGuid(@Nullable UUID packageGuid) { this.packageGuid = packageGuid; return this; } /** * Builds a new {@link ImmutableDropletInfo ImmutableDropletInfo}. * @return An immutable instance of DropletInfo * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableDropletInfo build() { return new ImmutableDropletInfo(guid, packageGuid); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy