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

com.sap.cloudfoundry.client.facade.domain.ImmutableCloudApplication Maven / Gradle / Ivy

There is a newer version: 2.56.0
Show newest version
package com.sap.cloudfoundry.client.facade.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 com.sap.cloudfoundry.client.facade.Nullable;
import java.util.Objects;
import org.cloudfoundry.client.v3.Metadata;
import org.immutables.value.Generated;

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

* Use the builder to create immutable instances: * {@code ImmutableCloudApplication.builder()}. */ @Generated(from = "CloudApplication", generator = "Immutables") @SuppressWarnings({"all"}) @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableCloudApplication extends CloudApplication { private final @Nullable String name; private final @Nullable CloudMetadata metadata; private final @Nullable Metadata v3Metadata; private final @Nullable CloudApplication.State state; private final @Nullable Lifecycle lifecycle; private final @Nullable CloudSpace space; private ImmutableCloudApplication( @Nullable String name, @Nullable CloudMetadata metadata, @Nullable Metadata v3Metadata, @Nullable CloudApplication.State state, @Nullable Lifecycle lifecycle, @Nullable CloudSpace space) { this.name = name; this.metadata = metadata; this.v3Metadata = v3Metadata; this.state = state; this.lifecycle = lifecycle; this.space = space; } /** * @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 state} attribute */ @JsonProperty("state") @Override public @Nullable CloudApplication.State getState() { return state; } /** * @return The value of the {@code lifecycle} attribute */ @JsonProperty("lifecycle") @Override public @Nullable Lifecycle getLifecycle() { return lifecycle; } /** * @return The value of the {@code space} attribute */ @JsonProperty("space") @Override public @Nullable CloudSpace getSpace() { return space; } /** * Copy the current immutable object by setting a value for the {@link CloudApplication#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 ImmutableCloudApplication withName(@Nullable String value) { if (Objects.equals(this.name, value)) return this; return new ImmutableCloudApplication(value, this.metadata, this.v3Metadata, this.state, this.lifecycle, this.space); } /** * Copy the current immutable object by setting a value for the {@link CloudApplication#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 ImmutableCloudApplication withMetadata(@Nullable CloudMetadata value) { if (this.metadata == value) return this; return new ImmutableCloudApplication(this.name, value, this.v3Metadata, this.state, this.lifecycle, this.space); } /** * Copy the current immutable object by setting a value for the {@link CloudApplication#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 ImmutableCloudApplication withV3Metadata(@Nullable Metadata value) { if (this.v3Metadata == value) return this; return new ImmutableCloudApplication(this.name, this.metadata, value, this.state, this.lifecycle, this.space); } /** * Copy the current immutable object by setting a value for the {@link CloudApplication#getState() state} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for state (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudApplication withState(@Nullable CloudApplication.State value) { if (this.state == value) return this; return new ImmutableCloudApplication(this.name, this.metadata, this.v3Metadata, value, this.lifecycle, this.space); } /** * Copy the current immutable object by setting a value for the {@link CloudApplication#getLifecycle() lifecycle} 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 lifecycle (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudApplication withLifecycle(@Nullable Lifecycle value) { if (this.lifecycle == value) return this; return new ImmutableCloudApplication(this.name, this.metadata, this.v3Metadata, this.state, value, this.space); } /** * Copy the current immutable object by setting a value for the {@link CloudApplication#getSpace() space} 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 space (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableCloudApplication withSpace(@Nullable CloudSpace value) { if (this.space == value) return this; return new ImmutableCloudApplication(this.name, this.metadata, this.v3Metadata, this.state, this.lifecycle, value); } /** * This instance is equal to all instances of {@code ImmutableCloudApplication} 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 ImmutableCloudApplication && equalTo(0, (ImmutableCloudApplication) another); } private boolean equalTo(int synthetic, ImmutableCloudApplication another) { return Objects.equals(name, another.name) && Objects.equals(metadata, another.metadata) && Objects.equals(v3Metadata, another.v3Metadata) && Objects.equals(state, another.state) && Objects.equals(lifecycle, another.lifecycle) && Objects.equals(space, another.space); } /** * Computes a hash code from attributes: {@code name}, {@code metadata}, {@code v3Metadata}, {@code state}, {@code lifecycle}, {@code space}. * @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(state); h += (h << 5) + Objects.hashCode(lifecycle); h += (h << 5) + Objects.hashCode(space); return h; } /** * Prints the immutable value {@code CloudApplication} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "CloudApplication{" + "name=" + name + ", metadata=" + metadata + ", v3Metadata=" + v3Metadata + ", state=" + state + ", lifecycle=" + lifecycle + ", space=" + space + "}"; } /** * 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 = "CloudApplication", generator = "Immutables") @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json extends CloudApplication { String name; CloudMetadata metadata; Metadata v3Metadata; CloudApplication.State state; Lifecycle lifecycle; CloudSpace space; @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("state") public void setState(@Nullable CloudApplication.State state) { this.state = state; } @JsonProperty("lifecycle") public void setLifecycle(@Nullable Lifecycle lifecycle) { this.lifecycle = lifecycle; } @JsonProperty("space") public void setSpace(@Nullable CloudSpace space) { this.space = space; } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public CloudMetadata getMetadata() { throw new UnsupportedOperationException(); } @Override public Metadata getV3Metadata() { throw new UnsupportedOperationException(); } @Override public CloudApplication.State getState() { throw new UnsupportedOperationException(); } @Override public Lifecycle getLifecycle() { throw new UnsupportedOperationException(); } @Override public CloudSpace getSpace() { 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 ImmutableCloudApplication fromJson(Json json) { ImmutableCloudApplication.Builder builder = ImmutableCloudApplication.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.state != null) { builder.state(json.state); } if (json.lifecycle != null) { builder.lifecycle(json.lifecycle); } if (json.space != null) { builder.space(json.space); } return builder.build(); } /** * Creates an immutable copy of a {@link CloudApplication} 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 CloudApplication instance */ public static ImmutableCloudApplication copyOf(CloudApplication instance) { if (instance instanceof ImmutableCloudApplication) { return (ImmutableCloudApplication) instance; } return ImmutableCloudApplication.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableCloudApplication ImmutableCloudApplication}. *

   * ImmutableCloudApplication.builder()
   *    .name(String | null) // nullable {@link CloudApplication#getName() name}
   *    .metadata(com.sap.cloudfoundry.client.facade.domain.CloudMetadata | null) // nullable {@link CloudApplication#getMetadata() metadata}
   *    .v3Metadata(org.cloudfoundry.client.v3.Metadata | null) // nullable {@link CloudApplication#getV3Metadata() v3Metadata}
   *    .state(com.sap.cloudfoundry.client.facade.domain.CloudApplication.State | null) // nullable {@link CloudApplication#getState() state}
   *    .lifecycle(com.sap.cloudfoundry.client.facade.domain.Lifecycle | null) // nullable {@link CloudApplication#getLifecycle() lifecycle}
   *    .space(com.sap.cloudfoundry.client.facade.domain.CloudSpace | null) // nullable {@link CloudApplication#getSpace() space}
   *    .build();
   * 
* @return A new ImmutableCloudApplication builder */ public static ImmutableCloudApplication.Builder builder() { return new ImmutableCloudApplication.Builder(); } /** * Builds instances of type {@link ImmutableCloudApplication ImmutableCloudApplication}. * 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 = "CloudApplication", generator = "Immutables") public static final class Builder { private String name; private CloudMetadata metadata; private Metadata v3Metadata; private CloudApplication.State state; private Lifecycle lifecycle; private CloudSpace space; private Builder() { } /** * Fill a builder with attribute values from the provided {@code com.sap.cloudfoundry.client.facade.domain.CloudApplication} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(CloudApplication instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code com.sap.cloudfoundry.client.facade.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((short) 0, (Object) instance); return this; } private void from(short _unused, Object object) { long bits = 0; if (object instanceof CloudApplication) { CloudApplication instance = (CloudApplication) object; if ((bits & 0x2L) == 0) { @Nullable Metadata v3MetadataValue = instance.getV3Metadata(); if (v3MetadataValue != null) { v3Metadata(v3MetadataValue); } bits |= 0x2L; } @Nullable Lifecycle lifecycleValue = instance.getLifecycle(); if (lifecycleValue != null) { lifecycle(lifecycleValue); } if ((bits & 0x4L) == 0) { @Nullable String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } bits |= 0x4L; } if ((bits & 0x1L) == 0) { @Nullable CloudMetadata metadataValue = instance.getMetadata(); if (metadataValue != null) { metadata(metadataValue); } bits |= 0x1L; } @Nullable CloudApplication.State stateValue = instance.getState(); if (stateValue != null) { state(stateValue); } @Nullable CloudSpace spaceValue = instance.getSpace(); if (spaceValue != null) { space(spaceValue); } } if (object instanceof CloudEntity) { CloudEntity instance = (CloudEntity) object; if ((bits & 0x2L) == 0) { @Nullable Metadata v3MetadataValue = instance.getV3Metadata(); if (v3MetadataValue != null) { v3Metadata(v3MetadataValue); } bits |= 0x2L; } if ((bits & 0x4L) == 0) { @Nullable String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } bits |= 0x4L; } if ((bits & 0x1L) == 0) { @Nullable CloudMetadata metadataValue = instance.getMetadata(); if (metadataValue != null) { metadata(metadataValue); } bits |= 0x1L; } } } /** * Initializes the value for the {@link CloudApplication#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 CloudApplication#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 CloudApplication#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 CloudApplication#getState() state} attribute. * @param state The value for state (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("state") public final Builder state(@Nullable CloudApplication.State state) { this.state = state; return this; } /** * Initializes the value for the {@link CloudApplication#getLifecycle() lifecycle} attribute. * @param lifecycle The value for lifecycle (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("lifecycle") public final Builder lifecycle(@Nullable Lifecycle lifecycle) { this.lifecycle = lifecycle; return this; } /** * Initializes the value for the {@link CloudApplication#getSpace() space} attribute. * @param space The value for space (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("space") public final Builder space(@Nullable CloudSpace space) { this.space = space; return this; } /** * Builds a new {@link ImmutableCloudApplication ImmutableCloudApplication}. * @return An immutable instance of CloudApplication * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableCloudApplication build() { return new ImmutableCloudApplication(name, metadata, v3Metadata, state, lifecycle, space); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy