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

org.cloudfoundry.client.v3.serviceofferings.Features Maven / Gradle / Ivy

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

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.ArrayList;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.immutables.value.Generated;

/**
 * Broker Catalog information for a Service Offering
 */
@Generated(from = "_Features", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class Features extends org.cloudfoundry.client.v3.serviceofferings._Features {
  private final @Nullable Boolean allowContextUpdates;
  private final Boolean bindable;
  private final Boolean bindingsRetrievable;
  private final Boolean instancesRetrievable;
  private final Boolean planUpdateable;

  private Features(Features.Builder builder) {
    this.allowContextUpdates = builder.allowContextUpdates;
    this.bindable = builder.bindable;
    this.bindingsRetrievable = builder.bindingsRetrievable;
    this.instancesRetrievable = builder.instancesRetrievable;
    this.planUpdateable = builder.planUpdateable;
  }

  /**
   * Whether service instance updates relating only to context are propagated to the service broker
   */
  @JsonProperty("allow_context_updates")
  @Override
  public @Nullable Boolean getAllowContextUpdates() {
    return allowContextUpdates;
  }

  /**
   * Whether service instances of the service can be bound to applications
   */
  @JsonProperty("bindable")
  @Override
  public Boolean getBindable() {
    return bindable;
  }

  /**
   * Whether the Fetching a service binding endpoint is supported for all service plans
   */
  @JsonProperty("bindings_retrievable")
  @Override
  public Boolean getBindingsRetrievable() {
    return bindingsRetrievable;
  }

  /**
   * Whether the Fetching a service instance endpoint is supported for all service plans
   */
  @JsonProperty("instances_retrievable")
  @Override
  public Boolean getInstancesRetrievable() {
    return instancesRetrievable;
  }

  /**
   * Whether the service offering supports upgrade/downgrade for service plans by default
   */
  @JsonProperty("plan_updateable")
  @Override
  public Boolean getPlanUpdateable() {
    return planUpdateable;
  }

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

  private boolean equalTo(int synthetic, Features another) {
    return Objects.equals(allowContextUpdates, another.allowContextUpdates)
        && bindable.equals(another.bindable)
        && bindingsRetrievable.equals(another.bindingsRetrievable)
        && instancesRetrievable.equals(another.instancesRetrievable)
        && planUpdateable.equals(another.planUpdateable);
  }

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

  /**
   * Prints the immutable value {@code Features} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "Features{"
        + "allowContextUpdates=" + allowContextUpdates
        + ", bindable=" + bindable
        + ", bindingsRetrievable=" + bindingsRetrievable
        + ", instancesRetrievable=" + instancesRetrievable
        + ", planUpdateable=" + planUpdateable
        + "}";
  }

  /**
   * 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 = "_Features", generator = "Immutables")
  @Deprecated
  @JsonDeserialize
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
  static final class Json extends org.cloudfoundry.client.v3.serviceofferings._Features {
    Boolean allowContextUpdates;
    Boolean bindable;
    Boolean bindingsRetrievable;
    Boolean instancesRetrievable;
    Boolean planUpdateable;
    @JsonProperty("allow_context_updates")
    public void setAllowContextUpdates(@Nullable Boolean allowContextUpdates) {
      this.allowContextUpdates = allowContextUpdates;
    }
    @JsonProperty("bindable")
    public void setBindable(Boolean bindable) {
      this.bindable = bindable;
    }
    @JsonProperty("bindings_retrievable")
    public void setBindingsRetrievable(Boolean bindingsRetrievable) {
      this.bindingsRetrievable = bindingsRetrievable;
    }
    @JsonProperty("instances_retrievable")
    public void setInstancesRetrievable(Boolean instancesRetrievable) {
      this.instancesRetrievable = instancesRetrievable;
    }
    @JsonProperty("plan_updateable")
    public void setPlanUpdateable(Boolean planUpdateable) {
      this.planUpdateable = planUpdateable;
    }
    @Override
    public Boolean getAllowContextUpdates() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getBindable() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getBindingsRetrievable() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getInstancesRetrievable() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getPlanUpdateable() { 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 Features fromJson(Json json) {
    Features.Builder builder = Features.builder();
    if (json.allowContextUpdates != null) {
      builder.allowContextUpdates(json.allowContextUpdates);
    }
    if (json.bindable != null) {
      builder.bindable(json.bindable);
    }
    if (json.bindingsRetrievable != null) {
      builder.bindingsRetrievable(json.bindingsRetrievable);
    }
    if (json.instancesRetrievable != null) {
      builder.instancesRetrievable(json.instancesRetrievable);
    }
    if (json.planUpdateable != null) {
      builder.planUpdateable(json.planUpdateable);
    }
    return builder.build();
  }

  /**
   * Creates a builder for {@link Features Features}.
   * 
   * Features.builder()
   *    .allowContextUpdates(Boolean | null) // nullable {@link Features#getAllowContextUpdates() allowContextUpdates}
   *    .bindable(Boolean) // required {@link Features#getBindable() bindable}
   *    .bindingsRetrievable(Boolean) // required {@link Features#getBindingsRetrievable() bindingsRetrievable}
   *    .instancesRetrievable(Boolean) // required {@link Features#getInstancesRetrievable() instancesRetrievable}
   *    .planUpdateable(Boolean) // required {@link Features#getPlanUpdateable() planUpdateable}
   *    .build();
   * 
* @return A new Features builder */ public static Features.Builder builder() { return new Features.Builder(); } /** * Builds instances of type {@link Features Features}. * 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 = "_Features", generator = "Immutables") public static final class Builder { private static final long INIT_BIT_BINDABLE = 0x1L; private static final long INIT_BIT_BINDINGS_RETRIEVABLE = 0x2L; private static final long INIT_BIT_INSTANCES_RETRIEVABLE = 0x4L; private static final long INIT_BIT_PLAN_UPDATEABLE = 0x8L; private long initBits = 0xfL; private Boolean allowContextUpdates; private Boolean bindable; private Boolean bindingsRetrievable; private Boolean instancesRetrievable; private Boolean planUpdateable; private Builder() { } /** * Fill a builder with attribute values from the provided {@code Features} 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(Features instance) { return from((_Features) instance); } /** * Copy abstract value type {@code _Features} 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(_Features instance) { Objects.requireNonNull(instance, "instance"); Boolean allowContextUpdatesValue = instance.getAllowContextUpdates(); if (allowContextUpdatesValue != null) { allowContextUpdates(allowContextUpdatesValue); } bindable(instance.getBindable()); bindingsRetrievable(instance.getBindingsRetrievable()); instancesRetrievable(instance.getInstancesRetrievable()); planUpdateable(instance.getPlanUpdateable()); return this; } /** * Initializes the value for the {@link Features#getAllowContextUpdates() allowContextUpdates} attribute. * @param allowContextUpdates The value for allowContextUpdates (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("allow_context_updates") public final Builder allowContextUpdates(@Nullable Boolean allowContextUpdates) { this.allowContextUpdates = allowContextUpdates; return this; } /** * Initializes the value for the {@link Features#getBindable() bindable} attribute. * @param bindable The value for bindable * @return {@code this} builder for use in a chained invocation */ @JsonProperty("bindable") public final Builder bindable(Boolean bindable) { this.bindable = Objects.requireNonNull(bindable, "bindable"); initBits &= ~INIT_BIT_BINDABLE; return this; } /** * Initializes the value for the {@link Features#getBindingsRetrievable() bindingsRetrievable} attribute. * @param bindingsRetrievable The value for bindingsRetrievable * @return {@code this} builder for use in a chained invocation */ @JsonProperty("bindings_retrievable") public final Builder bindingsRetrievable(Boolean bindingsRetrievable) { this.bindingsRetrievable = Objects.requireNonNull(bindingsRetrievable, "bindingsRetrievable"); initBits &= ~INIT_BIT_BINDINGS_RETRIEVABLE; return this; } /** * Initializes the value for the {@link Features#getInstancesRetrievable() instancesRetrievable} attribute. * @param instancesRetrievable The value for instancesRetrievable * @return {@code this} builder for use in a chained invocation */ @JsonProperty("instances_retrievable") public final Builder instancesRetrievable(Boolean instancesRetrievable) { this.instancesRetrievable = Objects.requireNonNull(instancesRetrievable, "instancesRetrievable"); initBits &= ~INIT_BIT_INSTANCES_RETRIEVABLE; return this; } /** * Initializes the value for the {@link Features#getPlanUpdateable() planUpdateable} attribute. * @param planUpdateable The value for planUpdateable * @return {@code this} builder for use in a chained invocation */ @JsonProperty("plan_updateable") public final Builder planUpdateable(Boolean planUpdateable) { this.planUpdateable = Objects.requireNonNull(planUpdateable, "planUpdateable"); initBits &= ~INIT_BIT_PLAN_UPDATEABLE; return this; } /** * Builds a new {@link Features Features}. * @return An immutable instance of Features * @throws java.lang.IllegalStateException if any required attributes are missing */ public Features build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new Features(this); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_BINDABLE) != 0) attributes.add("bindable"); if ((initBits & INIT_BIT_BINDINGS_RETRIEVABLE) != 0) attributes.add("bindingsRetrievable"); if ((initBits & INIT_BIT_INSTANCES_RETRIEVABLE) != 0) attributes.add("instancesRetrievable"); if ((initBits & INIT_BIT_PLAN_UPDATEABLE) != 0) attributes.add("planUpdateable"); return "Cannot build Features, some of required attributes are not set " + attributes; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy