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

org.cloudfoundry.client.lib.domain.ImmutableCloudPackage 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 org.cloudfoundry.client.lib.domain.annotation.Nullable;
import org.cloudfoundry.client.v3.Metadata;
import org.immutables.value.Generated;

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

* Use the builder to create immutable instances: * {@code ImmutableCloudPackage.builder()}. */ @Generated(from = "CloudPackage", generator = "Immutables") @SuppressWarnings({"all"}) @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableCloudPackage extends CloudPackage { private final @Nullable String name; private final @Nullable CloudMetadata metadata; private final @Nullable Metadata v3Metadata; private final @Nullable CloudPackage.Type type; private final @Nullable CloudPackage.Data data; private final @Nullable Status status; private ImmutableCloudPackage( @Nullable String name, @Nullable CloudMetadata metadata, @Nullable Metadata v3Metadata, @Nullable CloudPackage.Type type, @Nullable CloudPackage.Data data, @Nullable Status status) { this.name = name; this.metadata = metadata; this.v3Metadata = v3Metadata; this.type = type; this.data = data; this.status = status; } /** * @return The value of the {@code name} attribute */ @JsonProperty("name") @Override public @Nullable String getName() { return name; } /** * @return The value of the {@code metadata} attribute */ @JsonProperty("metadata") @Override public @Nullable CloudMetadata getMetadata() { return metadata; } /** * @return The value of the {@code v3Metadata} attribute */ @JsonProperty("v3Metadata") @Override public @Nullable Metadata getV3Metadata() { return v3Metadata; } /** * @return The value of the {@code type} attribute */ @JsonProperty("type") @Override public @Nullable CloudPackage.Type getType() { return type; } /** * @return The value of the {@code data} attribute */ @JsonProperty("data") @Override public @Nullable CloudPackage.Data getData() { return data; } /** * @return The value of the {@code status} attribute */ @JsonProperty("status") @Override public @Nullable Status getStatus() { return status; } /** * Copy the current immutable object by setting a value for the {@link CloudPackage#getName() name} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for name (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage withName(@Nullable String value) { if (Objects.equals(this.name, value)) return this; return new ImmutableCloudPackage(value, this.metadata, this.v3Metadata, this.type, this.data, this.status); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage#getMetadata() metadata} 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 metadata (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage withMetadata(@Nullable CloudMetadata value) { if (this.metadata == value) return this; return new ImmutableCloudPackage(this.name, value, this.v3Metadata, this.type, this.data, this.status); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage#getV3Metadata() v3Metadata} 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 v3Metadata (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage withV3Metadata(@Nullable Metadata value) { if (this.v3Metadata == value) return this; return new ImmutableCloudPackage(this.name, this.metadata, value, this.type, this.data, this.status); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage#getType() type} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for type (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage withType(@Nullable CloudPackage.Type value) { if (this.type == value) return this; if (Objects.equals(this.type, value)) return this; return new ImmutableCloudPackage(this.name, this.metadata, this.v3Metadata, value, this.data, this.status); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage#getData() data} 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 data (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage withData(@Nullable CloudPackage.Data value) { if (this.data == value) return this; return new ImmutableCloudPackage(this.name, this.metadata, this.v3Metadata, this.type, value, this.status); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage#getStatus() status} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for status (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage withStatus(@Nullable Status value) { if (this.status == value) return this; if (Objects.equals(this.status, value)) return this; return new ImmutableCloudPackage(this.name, this.metadata, this.v3Metadata, this.type, this.data, value); } /** * This instance is equal to all instances of {@code ImmutableCloudPackage} 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 ImmutableCloudPackage && equalTo((ImmutableCloudPackage) another); } private boolean equalTo(ImmutableCloudPackage another) { return Objects.equals(name, another.name) && Objects.equals(metadata, another.metadata) && Objects.equals(v3Metadata, another.v3Metadata) && Objects.equals(type, another.type) && Objects.equals(data, another.data) && Objects.equals(status, another.status); } /** * Computes a hash code from attributes: {@code name}, {@code metadata}, {@code v3Metadata}, {@code type}, {@code data}, {@code status}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(name); h += (h << 5) + Objects.hashCode(metadata); h += (h << 5) + Objects.hashCode(v3Metadata); h += (h << 5) + Objects.hashCode(type); h += (h << 5) + Objects.hashCode(data); h += (h << 5) + Objects.hashCode(status); return h; } /** * Prints the immutable value {@code CloudPackage} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "CloudPackage{" + "name=" + name + ", metadata=" + metadata + ", v3Metadata=" + v3Metadata + ", type=" + type + ", data=" + data + ", status=" + status + "}"; } /** * 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 = "CloudPackage", generator = "Immutables") @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json extends CloudPackage { String name; CloudMetadata metadata; Metadata v3Metadata; CloudPackage.Type type; CloudPackage.Data data; Status status; @JsonProperty("name") public void setName(@Nullable String name) { this.name = name; } @JsonProperty("metadata") public void setMetadata(@Nullable CloudMetadata metadata) { this.metadata = metadata; } @JsonProperty("v3Metadata") public void setV3Metadata(@Nullable Metadata v3Metadata) { this.v3Metadata = v3Metadata; } @JsonProperty("type") public void setType(@Nullable CloudPackage.Type type) { this.type = type; } @JsonProperty("data") public void setData(@Nullable CloudPackage.Data data) { this.data = data; } @JsonProperty("status") public void setStatus(@Nullable Status status) { this.status = status; } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public CloudMetadata getMetadata() { throw new UnsupportedOperationException(); } @Override public Metadata getV3Metadata() { throw new UnsupportedOperationException(); } @Override public CloudPackage.Type getType() { throw new UnsupportedOperationException(); } @Override public CloudPackage.Data getData() { throw new UnsupportedOperationException(); } @Override public Status getStatus() { 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 ImmutableCloudPackage fromJson(Json json) { ImmutableCloudPackage.Builder builder = ImmutableCloudPackage.builder(); if (json.name != null) { builder.name(json.name); } if (json.metadata != null) { builder.metadata(json.metadata); } if (json.v3Metadata != null) { builder.v3Metadata(json.v3Metadata); } if (json.type != null) { builder.type(json.type); } if (json.data != null) { builder.data(json.data); } if (json.status != null) { builder.status(json.status); } return builder.build(); } /** * Creates an immutable copy of a {@link CloudPackage} 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 CloudPackage instance */ public static ImmutableCloudPackage copyOf(CloudPackage instance) { if (instance instanceof ImmutableCloudPackage) { return (ImmutableCloudPackage) instance; } return ImmutableCloudPackage.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableCloudPackage ImmutableCloudPackage}. *

   * ImmutableCloudPackage.builder()
   *    .name(String | null) // nullable {@link CloudPackage#getName() name}
   *    .metadata(org.cloudfoundry.client.lib.domain.CloudMetadata | null) // nullable {@link CloudPackage#getMetadata() metadata}
   *    .v3Metadata(org.cloudfoundry.client.v3.Metadata | null) // nullable {@link CloudPackage#getV3Metadata() v3Metadata}
   *    .type(org.cloudfoundry.client.lib.domain.CloudPackage.Type | null) // nullable {@link CloudPackage#getType() type}
   *    .data(org.cloudfoundry.client.lib.domain.CloudPackage.Data | null) // nullable {@link CloudPackage#getData() data}
   *    .status(org.cloudfoundry.client.lib.domain.Status | null) // nullable {@link CloudPackage#getStatus() status}
   *    .build();
   * 
* @return A new ImmutableCloudPackage builder */ public static ImmutableCloudPackage.Builder builder() { return new ImmutableCloudPackage.Builder(); } /** * Builds instances of type {@link ImmutableCloudPackage ImmutableCloudPackage}. * 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 = "CloudPackage", generator = "Immutables") public static final class Builder { private String name; private CloudMetadata metadata; private Metadata v3Metadata; private CloudPackage.Type type; private CloudPackage.Data data; private Status status; private Builder() { } /** * Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.lib.domain.CloudEntity} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(CloudEntity instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.lib.domain.CloudPackage} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(CloudPackage instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return this; } private void from(Object object) { if (object instanceof CloudEntity) { CloudEntity instance = (CloudEntity) object; @Nullable String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } @Nullable Metadata v3MetadataValue = instance.getV3Metadata(); if (v3MetadataValue != null) { v3Metadata(v3MetadataValue); } @Nullable CloudMetadata metadataValue = instance.getMetadata(); if (metadataValue != null) { metadata(metadataValue); } } if (object instanceof CloudPackage) { CloudPackage instance = (CloudPackage) object; @Nullable CloudPackage.Data dataValue = instance.getData(); if (dataValue != null) { data(dataValue); } @Nullable CloudPackage.Type typeValue = instance.getType(); if (typeValue != null) { type(typeValue); } @Nullable Status statusValue = instance.getStatus(); if (statusValue != null) { status(statusValue); } } } /** * Initializes the value for the {@link CloudPackage#getName() name} attribute. * @param name The value for name (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("name") public final Builder name(@Nullable String name) { this.name = name; return this; } /** * Initializes the value for the {@link CloudPackage#getMetadata() metadata} attribute. * @param metadata The value for metadata (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("metadata") public final Builder metadata(@Nullable CloudMetadata metadata) { this.metadata = metadata; return this; } /** * Initializes the value for the {@link CloudPackage#getV3Metadata() v3Metadata} attribute. * @param v3Metadata The value for v3Metadata (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("v3Metadata") public final Builder v3Metadata(@Nullable Metadata v3Metadata) { this.v3Metadata = v3Metadata; return this; } /** * Initializes the value for the {@link CloudPackage#getType() type} attribute. * @param type The value for type (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("type") public final Builder type(@Nullable CloudPackage.Type type) { this.type = type; return this; } /** * Initializes the value for the {@link CloudPackage#getData() data} attribute. * @param data The value for data (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("data") public final Builder data(@Nullable CloudPackage.Data data) { this.data = data; return this; } /** * Initializes the value for the {@link CloudPackage#getStatus() status} attribute. * @param status The value for status (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("status") public final Builder status(@Nullable Status status) { this.status = status; return this; } /** * Builds a new {@link ImmutableCloudPackage ImmutableCloudPackage}. * @return An immutable instance of CloudPackage * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableCloudPackage build() { return new ImmutableCloudPackage(name, metadata, v3Metadata, type, data, status); } } /** * Immutable implementation of {@link CloudPackage.Data}. *

* Use the builder to create immutable instances: * {@code ImmutableCloudPackage.ImmutableData.builder()}. */ @Generated(from = "CloudPackage.Data", generator = "Immutables") public static final class ImmutableData implements CloudPackage.Data { private final @Nullable CloudPackage.Checksum checksum; private final @Nullable String error; private ImmutableData( @Nullable CloudPackage.Checksum checksum, @Nullable String error) { this.checksum = checksum; this.error = error; } /** * @return The value of the {@code checksum} attribute */ @JsonProperty("checksum") @Override public @Nullable CloudPackage.Checksum getChecksum() { return checksum; } /** * @return The value of the {@code error} attribute */ @JsonProperty("error") @Override public @Nullable String getError() { return error; } /** * Copy the current immutable object by setting a value for the {@link CloudPackage.Data#getChecksum() checksum} 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 checksum (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage.ImmutableData withChecksum(@Nullable CloudPackage.Checksum value) { if (this.checksum == value) return this; return new ImmutableCloudPackage.ImmutableData(value, this.error); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage.Data#getError() error} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for error (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage.ImmutableData withError(@Nullable String value) { if (Objects.equals(this.error, value)) return this; return new ImmutableCloudPackage.ImmutableData(this.checksum, value); } /** * This instance is equal to all instances of {@code ImmutableData} 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 ImmutableCloudPackage.ImmutableData && equalTo((ImmutableCloudPackage.ImmutableData) another); } private boolean equalTo(ImmutableCloudPackage.ImmutableData another) { return Objects.equals(checksum, another.checksum) && Objects.equals(error, another.error); } /** * Computes a hash code from attributes: {@code checksum}, {@code error}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(checksum); h += (h << 5) + Objects.hashCode(error); return h; } /** * Prints the immutable value {@code Data} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "Data{" + "checksum=" + checksum + ", error=" + error + "}"; } /** * 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 = "CloudPackage.Data", generator = "Immutables") @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements CloudPackage.Data { CloudPackage.Checksum checksum; String error; @JsonProperty("checksum") public void setChecksum(@Nullable CloudPackage.Checksum checksum) { this.checksum = checksum; } @JsonProperty("error") public void setError(@Nullable String error) { this.error = error; } @Override public CloudPackage.Checksum getChecksum() { throw new UnsupportedOperationException(); } @Override public String getError() { 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 ImmutableCloudPackage.ImmutableData fromJson(Json json) { ImmutableCloudPackage.ImmutableData.Builder builder = ImmutableCloudPackage.ImmutableData.builder(); if (json.checksum != null) { builder.checksum(json.checksum); } if (json.error != null) { builder.error(json.error); } return builder.build(); } /** * Creates an immutable copy of a {@link CloudPackage.Data} 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 Data instance */ public static ImmutableCloudPackage.ImmutableData copyOf(CloudPackage.Data instance) { if (instance instanceof ImmutableCloudPackage.ImmutableData) { return (ImmutableCloudPackage.ImmutableData) instance; } return ImmutableCloudPackage.ImmutableData.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableCloudPackage.ImmutableData ImmutableData}. *

     * ImmutableCloudPackage.ImmutableData.builder()
     *    .checksum(org.cloudfoundry.client.lib.domain.CloudPackage.Checksum | null) // nullable {@link CloudPackage.Data#getChecksum() checksum}
     *    .error(String | null) // nullable {@link CloudPackage.Data#getError() error}
     *    .build();
     * 
* @return A new ImmutableData builder */ public static ImmutableCloudPackage.ImmutableData.Builder builder() { return new ImmutableCloudPackage.ImmutableData.Builder(); } /** * Builds instances of type {@link ImmutableCloudPackage.ImmutableData ImmutableData}. * 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 = "CloudPackage.Data", generator = "Immutables") public static final class Builder { private CloudPackage.Checksum checksum; private String error; private Builder() { } /** * Fill a builder with attribute values from the provided {@code Data} 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(CloudPackage.Data instance) { Objects.requireNonNull(instance, "instance"); @Nullable CloudPackage.Checksum checksumValue = instance.getChecksum(); if (checksumValue != null) { checksum(checksumValue); } @Nullable String errorValue = instance.getError(); if (errorValue != null) { error(errorValue); } return this; } /** * Initializes the value for the {@link CloudPackage.Data#getChecksum() checksum} attribute. * @param checksum The value for checksum (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("checksum") public final Builder checksum(@Nullable CloudPackage.Checksum checksum) { this.checksum = checksum; return this; } /** * Initializes the value for the {@link CloudPackage.Data#getError() error} attribute. * @param error The value for error (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("error") public final Builder error(@Nullable String error) { this.error = error; return this; } /** * Builds a new {@link ImmutableCloudPackage.ImmutableData ImmutableData}. * @return An immutable instance of Data * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableCloudPackage.ImmutableData build() { return new ImmutableCloudPackage.ImmutableData(checksum, error); } } } /** * Immutable implementation of {@link CloudPackage.Checksum}. *

* Use the builder to create immutable instances: * {@code ImmutableCloudPackage.ImmutableChecksum.builder()}. */ @Generated(from = "CloudPackage.Checksum", generator = "Immutables") public static final class ImmutableChecksum implements CloudPackage.Checksum { private final @Nullable String algorithm; private final @Nullable String value; private ImmutableChecksum( @Nullable String algorithm, @Nullable String value) { this.algorithm = algorithm; this.value = value; } /** * @return The value of the {@code algorithm} attribute */ @JsonProperty("algorithm") @Override public @Nullable String getAlgorithm() { return algorithm; } /** * @return The value of the {@code value} attribute */ @JsonProperty("value") @Override public @Nullable String getValue() { return value; } /** * Copy the current immutable object by setting a value for the {@link CloudPackage.Checksum#getAlgorithm() algorithm} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for algorithm (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage.ImmutableChecksum withAlgorithm(@Nullable String value) { if (Objects.equals(this.algorithm, value)) return this; return new ImmutableCloudPackage.ImmutableChecksum(value, this.value); } /** * Copy the current immutable object by setting a value for the {@link CloudPackage.Checksum#getValue() value} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for value (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudPackage.ImmutableChecksum withValue(@Nullable String value) { if (Objects.equals(this.value, value)) return this; return new ImmutableCloudPackage.ImmutableChecksum(this.algorithm, value); } /** * This instance is equal to all instances of {@code ImmutableChecksum} 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 ImmutableCloudPackage.ImmutableChecksum && equalTo((ImmutableCloudPackage.ImmutableChecksum) another); } private boolean equalTo(ImmutableCloudPackage.ImmutableChecksum another) { return Objects.equals(algorithm, another.algorithm) && Objects.equals(value, another.value); } /** * Computes a hash code from attributes: {@code algorithm}, {@code value}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(algorithm); h += (h << 5) + Objects.hashCode(value); return h; } /** * Prints the immutable value {@code Checksum} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "Checksum{" + "algorithm=" + algorithm + ", value=" + value + "}"; } /** * 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 = "CloudPackage.Checksum", generator = "Immutables") @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements CloudPackage.Checksum { String algorithm; String value; @JsonProperty("algorithm") public void setAlgorithm(@Nullable String algorithm) { this.algorithm = algorithm; } @JsonProperty("value") public void setValue(@Nullable String value) { this.value = value; } @Override public String getAlgorithm() { throw new UnsupportedOperationException(); } @Override public String getValue() { 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 ImmutableCloudPackage.ImmutableChecksum fromJson(Json json) { ImmutableCloudPackage.ImmutableChecksum.Builder builder = ImmutableCloudPackage.ImmutableChecksum.builder(); if (json.algorithm != null) { builder.algorithm(json.algorithm); } if (json.value != null) { builder.value(json.value); } return builder.build(); } /** * Creates an immutable copy of a {@link CloudPackage.Checksum} 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 Checksum instance */ public static ImmutableCloudPackage.ImmutableChecksum copyOf(CloudPackage.Checksum instance) { if (instance instanceof ImmutableCloudPackage.ImmutableChecksum) { return (ImmutableCloudPackage.ImmutableChecksum) instance; } return ImmutableCloudPackage.ImmutableChecksum.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableCloudPackage.ImmutableChecksum ImmutableChecksum}. *

     * ImmutableCloudPackage.ImmutableChecksum.builder()
     *    .algorithm(String | null) // nullable {@link CloudPackage.Checksum#getAlgorithm() algorithm}
     *    .value(String | null) // nullable {@link CloudPackage.Checksum#getValue() value}
     *    .build();
     * 
* @return A new ImmutableChecksum builder */ public static ImmutableCloudPackage.ImmutableChecksum.Builder builder() { return new ImmutableCloudPackage.ImmutableChecksum.Builder(); } /** * Builds instances of type {@link ImmutableCloudPackage.ImmutableChecksum ImmutableChecksum}. * 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 = "CloudPackage.Checksum", generator = "Immutables") public static final class Builder { private String algorithm; private String value; private Builder() { } /** * Fill a builder with attribute values from the provided {@code Checksum} 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(CloudPackage.Checksum instance) { Objects.requireNonNull(instance, "instance"); @Nullable String algorithmValue = instance.getAlgorithm(); if (algorithmValue != null) { algorithm(algorithmValue); } @Nullable String valueValue = instance.getValue(); if (valueValue != null) { value(valueValue); } return this; } /** * Initializes the value for the {@link CloudPackage.Checksum#getAlgorithm() algorithm} attribute. * @param algorithm The value for algorithm (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("algorithm") public final Builder algorithm(@Nullable String algorithm) { this.algorithm = algorithm; return this; } /** * Initializes the value for the {@link CloudPackage.Checksum#getValue() value} attribute. * @param value The value for value (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("value") public final Builder value(@Nullable String value) { this.value = value; return this; } /** * Builds a new {@link ImmutableCloudPackage.ImmutableChecksum ImmutableChecksum}. * @return An immutable instance of Checksum * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableCloudPackage.ImmutableChecksum build() { return new ImmutableCloudPackage.ImmutableChecksum(algorithm, value); } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy