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

org.cloudfoundry.client.v3.processes.ProcessUsage Maven / Gradle / Ivy

There is a newer version: 5.12.2.RELEASE
Show newest version
package org.cloudfoundry.client.v3.processes;

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.Nullable;
import org.immutables.value.Generated;

/**
 * Process usage information
 */
@Generated(from = "_ProcessUsage", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class ProcessUsage extends org.cloudfoundry.client.v3.processes._ProcessUsage {
  private final @Nullable Double cpu;
  private final @Nullable Long disk;
  private final @Nullable Long memory;
  private final @Nullable String time;

  private ProcessUsage(ProcessUsage.Builder builder) {
    this.cpu = builder.cpu;
    this.disk = builder.disk;
    this.memory = builder.memory;
    this.time = builder.time;
  }

  /**
   * The CPU
   */
  @JsonProperty("cpu")
  @Override
  public @Nullable Double getCpu() {
    return cpu;
  }

  /**
   * The disk
   */
  @JsonProperty("disk")
  @Override
  public @Nullable Long getDisk() {
    return disk;
  }

  /**
   * The memory
   */
  @JsonProperty("mem")
  @Override
  public @Nullable Long getMemory() {
    return memory;
  }

  /**
   * The time
   */
  @JsonProperty("time")
  @Override
  public @Nullable String getTime() {
    return time;
  }

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

  private boolean equalTo(int synthetic, ProcessUsage another) {
    return Objects.equals(cpu, another.cpu)
        && Objects.equals(disk, another.disk)
        && Objects.equals(memory, another.memory)
        && Objects.equals(time, another.time);
  }

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

  /**
   * Prints the immutable value {@code ProcessUsage} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "ProcessUsage{"
        + "cpu=" + cpu
        + ", disk=" + disk
        + ", memory=" + memory
        + ", time=" + time
        + "}";
  }

  /**
   * 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 = "_ProcessUsage", generator = "Immutables")
  @Deprecated
  @JsonDeserialize
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
  static final class Json extends org.cloudfoundry.client.v3.processes._ProcessUsage {
    Double cpu;
    Long disk;
    Long memory;
    String time;
    @JsonProperty("cpu")
    public void setCpu(@Nullable Double cpu) {
      this.cpu = cpu;
    }
    @JsonProperty("disk")
    public void setDisk(@Nullable Long disk) {
      this.disk = disk;
    }
    @JsonProperty("mem")
    public void setMemory(@Nullable Long memory) {
      this.memory = memory;
    }
    @JsonProperty("time")
    public void setTime(@Nullable String time) {
      this.time = time;
    }
    @Override
    public Double getCpu() { throw new UnsupportedOperationException(); }
    @Override
    public Long getDisk() { throw new UnsupportedOperationException(); }
    @Override
    public Long getMemory() { throw new UnsupportedOperationException(); }
    @Override
    public String getTime() { 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 ProcessUsage fromJson(Json json) {
    ProcessUsage.Builder builder = ProcessUsage.builder();
    if (json.cpu != null) {
      builder.cpu(json.cpu);
    }
    if (json.disk != null) {
      builder.disk(json.disk);
    }
    if (json.memory != null) {
      builder.memory(json.memory);
    }
    if (json.time != null) {
      builder.time(json.time);
    }
    return builder.build();
  }

  /**
   * Creates a builder for {@link ProcessUsage ProcessUsage}.
   * 
   * ProcessUsage.builder()
   *    .cpu(Double | null) // nullable {@link ProcessUsage#getCpu() cpu}
   *    .disk(Long | null) // nullable {@link ProcessUsage#getDisk() disk}
   *    .memory(Long | null) // nullable {@link ProcessUsage#getMemory() memory}
   *    .time(String | null) // nullable {@link ProcessUsage#getTime() time}
   *    .build();
   * 
* @return A new ProcessUsage builder */ public static ProcessUsage.Builder builder() { return new ProcessUsage.Builder(); } /** * Builds instances of type {@link ProcessUsage ProcessUsage}. * 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 = "_ProcessUsage", generator = "Immutables") public static final class Builder { private Double cpu; private Long disk; private Long memory; private String time; private Builder() { } /** * Fill a builder with attribute values from the provided {@code ProcessUsage} 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(ProcessUsage instance) { return from((_ProcessUsage) instance); } /** * Copy abstract value type {@code _ProcessUsage} 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(_ProcessUsage instance) { Objects.requireNonNull(instance, "instance"); Double cpuValue = instance.getCpu(); if (cpuValue != null) { cpu(cpuValue); } Long diskValue = instance.getDisk(); if (diskValue != null) { disk(diskValue); } Long memoryValue = instance.getMemory(); if (memoryValue != null) { memory(memoryValue); } String timeValue = instance.getTime(); if (timeValue != null) { time(timeValue); } return this; } /** * Initializes the value for the {@link ProcessUsage#getCpu() cpu} attribute. * @param cpu The value for cpu (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("cpu") public final Builder cpu(@Nullable Double cpu) { this.cpu = cpu; return this; } /** * Initializes the value for the {@link ProcessUsage#getDisk() disk} attribute. * @param disk The value for disk (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("disk") public final Builder disk(@Nullable Long disk) { this.disk = disk; return this; } /** * Initializes the value for the {@link ProcessUsage#getMemory() memory} attribute. * @param memory The value for memory (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("mem") public final Builder memory(@Nullable Long memory) { this.memory = memory; return this; } /** * Initializes the value for the {@link ProcessUsage#getTime() time} attribute. * @param time The value for time (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("time") public final Builder time(@Nullable String time) { this.time = time; return this; } /** * Builds a new {@link ProcessUsage ProcessUsage}. * @return An immutable instance of ProcessUsage * @throws java.lang.IllegalStateException if any required attributes are missing */ public ProcessUsage build() { return new ProcessUsage(this); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy