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

org.cloudfoundry.client.v2.environmentvariablegroups.UpdateRunningEnvironmentVariablesRequest Maven / Gradle / Ivy

package org.cloudfoundry.client.v2.environmentvariablegroups;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.immutables.value.Generated;

/**
 * The request payload for the update running environment variable group
 */
@Generated(from = "_UpdateRunningEnvironmentVariablesRequest", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class UpdateRunningEnvironmentVariablesRequest
    extends org.cloudfoundry.client.v2.environmentvariablegroups._UpdateRunningEnvironmentVariablesRequest {
  private final @Nullable Map environmentVariables;

  private UpdateRunningEnvironmentVariablesRequest(UpdateRunningEnvironmentVariablesRequest.Builder builder) {
    this.environmentVariables = builder.environmentVariables == null ? null : createUnmodifiableMap(false, false, builder.environmentVariables);
  }

  /**
   * @return The value of the {@code environmentVariables} attribute
   */
  @JsonProperty("environmentVariables")
  @JsonValue
  @Override
  public @Nullable Map getEnvironmentVariables() {
    return environmentVariables;
  }

  /**
   * This instance is equal to all instances of {@code UpdateRunningEnvironmentVariablesRequest} 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 UpdateRunningEnvironmentVariablesRequest
        && equalTo(0, (UpdateRunningEnvironmentVariablesRequest) another);
  }

  private boolean equalTo(int synthetic, UpdateRunningEnvironmentVariablesRequest another) {
    return Objects.equals(environmentVariables, another.environmentVariables);
  }

  /**
   * Computes a hash code from attributes: {@code environmentVariables}.
   * @return hashCode value
   */
  @Override
  public int hashCode() {
    int h = 5381;
    h += (h << 5) + Objects.hashCode(environmentVariables);
    return h;
  }

  /**
   * Prints the immutable value {@code UpdateRunningEnvironmentVariablesRequest} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "UpdateRunningEnvironmentVariablesRequest{"
        + "environmentVariables=" + environmentVariables
        + "}";
  }

  /**
   * @param jsonValue to construct object from
   * @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 UpdateRunningEnvironmentVariablesRequest fromJson(Map jsonValue) {
    UpdateRunningEnvironmentVariablesRequest.Builder builder = UpdateRunningEnvironmentVariablesRequest.builder();
    builder.putAllEnvironmentVariables(jsonValue);
    return builder.build();
  }

  /**
   * Creates a builder for {@link UpdateRunningEnvironmentVariablesRequest UpdateRunningEnvironmentVariablesRequest}.
   * 
   * UpdateRunningEnvironmentVariablesRequest.builder()
   *    .environmentVariables(Map&lt;String, Object&gt; | null) // nullable {@link UpdateRunningEnvironmentVariablesRequest#getEnvironmentVariables() environmentVariables}
   *    .build();
   * 
* @return A new UpdateRunningEnvironmentVariablesRequest builder */ public static UpdateRunningEnvironmentVariablesRequest.Builder builder() { return new UpdateRunningEnvironmentVariablesRequest.Builder(); } /** * Builds instances of type {@link UpdateRunningEnvironmentVariablesRequest UpdateRunningEnvironmentVariablesRequest}. * 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 = "_UpdateRunningEnvironmentVariablesRequest", generator = "Immutables") public static final class Builder { private Map environmentVariables = null; private Builder() { } /** * Fill a builder with attribute values from the provided {@code UpdateRunningEnvironmentVariablesRequest} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(UpdateRunningEnvironmentVariablesRequest instance) { return from((_UpdateRunningEnvironmentVariablesRequest) instance); } /** * Copy abstract value type {@code _UpdateRunningEnvironmentVariablesRequest} instance into builder. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ final Builder from(_UpdateRunningEnvironmentVariablesRequest instance) { Objects.requireNonNull(instance, "instance"); Map environmentVariablesValue = instance.getEnvironmentVariables(); if (environmentVariablesValue != null) { putAllEnvironmentVariables(environmentVariablesValue); } return this; } /** * Put one entry to the {@link UpdateRunningEnvironmentVariablesRequest#getEnvironmentVariables() environmentVariables} map. * @param key The key in the environmentVariables map * @param value The associated value in the environmentVariables map * @return {@code this} builder for use in a chained invocation */ public final Builder environmentVariable(String key, Object value) { if (this.environmentVariables == null) { this.environmentVariables = new LinkedHashMap(); } this.environmentVariables.put(key, value); return this; } /** * Put one entry to the {@link UpdateRunningEnvironmentVariablesRequest#getEnvironmentVariables() environmentVariables} map. Nulls are not permitted * @param entry The key and value entry * @return {@code this} builder for use in a chained invocation */ public final Builder environmentVariable(Map.Entry entry) { if (this.environmentVariables == null) { this.environmentVariables = new LinkedHashMap(); } String k = entry.getKey(); Object v = entry.getValue(); this.environmentVariables.put(k, v); return this; } /** * Sets or replaces all mappings from the specified map as entries for the {@link UpdateRunningEnvironmentVariablesRequest#getEnvironmentVariables() environmentVariables} map. Nulls are not permitted as keys or values, but parameter itself can be null * @param entries The entries that will be added to the environmentVariables map * @return {@code this} builder for use in a chained invocation */ public final Builder environmentVariables(@Nullable Map entries) { if (entries == null) { this.environmentVariables = null; return this; } this.environmentVariables = new LinkedHashMap(); return putAllEnvironmentVariables(entries); } /** * Put all mappings from the specified map as entries to {@link UpdateRunningEnvironmentVariablesRequest#getEnvironmentVariables() environmentVariables} map. Nulls are not permitted * @param entries The entries that will be added to the environmentVariables map * @return {@code this} builder for use in a chained invocation */ public final Builder putAllEnvironmentVariables(Map entries) { if (this.environmentVariables == null) { this.environmentVariables = new LinkedHashMap(); } for (Map.Entry e : entries.entrySet()) { String k = e.getKey(); Object v = e.getValue(); this.environmentVariables.put(k, v); } return this; } /** * Builds a new {@link UpdateRunningEnvironmentVariablesRequest UpdateRunningEnvironmentVariablesRequest}. * @return An immutable instance of UpdateRunningEnvironmentVariablesRequest * @throws java.lang.IllegalStateException if any required attributes are missing */ public UpdateRunningEnvironmentVariablesRequest build() { return new UpdateRunningEnvironmentVariablesRequest(this); } } private static Map createUnmodifiableMap(boolean checkNulls, boolean skipNulls, Map map) { switch (map.size()) { case 0: return Collections.emptyMap(); case 1: { Map.Entry e = map.entrySet().iterator().next(); K k = e.getKey(); V v = e.getValue(); if (checkNulls) { Objects.requireNonNull(k, "key"); Objects.requireNonNull(v, v == null ? "value for key: " + k : null); } if (skipNulls && (k == null || v == null)) { return Collections.emptyMap(); } return Collections.singletonMap(k, v); } default: { Map linkedMap = new LinkedHashMap<>(map.size() * 4 / 3 + 1); if (skipNulls || checkNulls) { for (Map.Entry e : map.entrySet()) { K k = e.getKey(); V v = e.getValue(); if (skipNulls) { if (k == null || v == null) continue; } else if (checkNulls) { Objects.requireNonNull(k, "key"); Objects.requireNonNull(v, v == null ? "value for key: " + k : null); } linkedMap.put(k, v); } } else { linkedMap.putAll(map); } return Collections.unmodifiableMap(linkedMap); } } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy