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

com.sap.cloudfoundry.client.facade.adapters.ImmutableRawCloudProcess Maven / Gradle / Ivy

There is a newer version: 2.56.0
Show newest version
package com.sap.cloudfoundry.client.facade.adapters;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.client.v3.processes.Process;
import org.immutables.value.Generated;

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

* Use the builder to create immutable instances: * {@code ImmutableRawCloudProcess.builder()}. * Use the static factory method to create immutable instances: * {@code ImmutableRawCloudProcess.of()}. */ @Generated(from = "RawCloudProcess", generator = "Immutables") @SuppressWarnings({"all"}) @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableRawCloudProcess extends RawCloudProcess { private final Process process; private ImmutableRawCloudProcess(Process process) { this.process = Objects.requireNonNull(process, "process"); } private ImmutableRawCloudProcess(ImmutableRawCloudProcess original, Process process) { this.process = process; } /** * @return The value of the {@code process} attribute */ @Override public Process getProcess() { return process; } /** * Copy the current immutable object by setting a value for the {@link RawCloudProcess#getProcess() process} 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 process * @return A modified copy of the {@code this} object */ public final ImmutableRawCloudProcess withProcess(Process value) { if (this.process == value) return this; Process newValue = Objects.requireNonNull(value, "process"); return new ImmutableRawCloudProcess(this, newValue); } /** * This instance is equal to all instances of {@code ImmutableRawCloudProcess} 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 ImmutableRawCloudProcess && equalTo(0, (ImmutableRawCloudProcess) another); } private boolean equalTo(int synthetic, ImmutableRawCloudProcess another) { return process.equals(another.process); } /** * Computes a hash code from attributes: {@code process}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + process.hashCode(); return h; } /** * Prints the immutable value {@code RawCloudProcess} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "RawCloudProcess{" + "process=" + process + "}"; } /** * Construct a new immutable {@code RawCloudProcess} instance. * @param process The value for the {@code process} attribute * @return An immutable RawCloudProcess instance */ public static ImmutableRawCloudProcess of(Process process) { return new ImmutableRawCloudProcess(process); } /** * Creates an immutable copy of a {@link RawCloudProcess} 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 RawCloudProcess instance */ public static ImmutableRawCloudProcess copyOf(RawCloudProcess instance) { if (instance instanceof ImmutableRawCloudProcess) { return (ImmutableRawCloudProcess) instance; } return ImmutableRawCloudProcess.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableRawCloudProcess ImmutableRawCloudProcess}. *

   * ImmutableRawCloudProcess.builder()
   *    .process(org.cloudfoundry.client.v3.processes.Process) // required {@link RawCloudProcess#getProcess() process}
   *    .build();
   * 
* @return A new ImmutableRawCloudProcess builder */ public static ImmutableRawCloudProcess.Builder builder() { return new ImmutableRawCloudProcess.Builder(); } /** * Builds instances of type {@link ImmutableRawCloudProcess ImmutableRawCloudProcess}. * 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 = "RawCloudProcess", generator = "Immutables") public static final class Builder { private static final long INIT_BIT_PROCESS = 0x1L; private long initBits = 0x1L; private Process process; private Builder() { } /** * Fill a builder with attribute values from the provided {@code RawCloudProcess} 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(RawCloudProcess instance) { Objects.requireNonNull(instance, "instance"); this.process(instance.getProcess()); return this; } /** * Initializes the value for the {@link RawCloudProcess#getProcess() process} attribute. * @param process The value for process * @return {@code this} builder for use in a chained invocation */ public final Builder process(Process process) { this.process = Objects.requireNonNull(process, "process"); initBits &= ~INIT_BIT_PROCESS; return this; } /** * Builds a new {@link ImmutableRawCloudProcess ImmutableRawCloudProcess}. * @return An immutable instance of RawCloudProcess * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableRawCloudProcess build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableRawCloudProcess(null, process); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_PROCESS) != 0) attributes.add("process"); return "Cannot build RawCloudProcess, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy