org.cloudfoundry.client.v2.servicebindings.ServiceBindingEntity Maven / Gradle / Ivy
package org.cloudfoundry.client.v2.servicebindings;
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.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.cloudfoundry.client.v2.serviceinstances.GatewayData;
import org.immutables.value.Generated;
/**
* The entity response payload for the Service Binding resource
*/
@Generated(from = "_ServiceBindingEntity", generator = "Immutables")
@SuppressWarnings({"all", "deprecation", "removal"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class ServiceBindingEntity
extends org.cloudfoundry.client.v2.servicebindings._ServiceBindingEntity {
private final @Nullable String applicationId;
private final @Nullable String applicationUrl;
private final @Nullable Map bindingOptions;
private final @Nullable Map credentials;
private final @Nullable GatewayData gatewayData;
private final @Nullable String gatewayName;
private final @Nullable LastOperation lastOperation;
private final @Nullable String name;
private final @Nullable String serviceBindingParametersUrl;
private final @Nullable String serviceInstanceId;
private final @Nullable String serviceInstanceUrl;
private final @Nullable String syslogDrainUrl;
private final @Nullable List volumeMounts;
private ServiceBindingEntity(ServiceBindingEntity.Builder builder) {
this.applicationId = builder.applicationId;
this.applicationUrl = builder.applicationUrl;
this.bindingOptions = builder.bindingOptions == null ? null : createUnmodifiableMap(false, false, builder.bindingOptions);
this.credentials = builder.credentials == null ? null : createUnmodifiableMap(false, false, builder.credentials);
this.gatewayData = builder.gatewayData;
this.gatewayName = builder.gatewayName;
this.lastOperation = builder.lastOperation;
this.name = builder.name;
this.serviceBindingParametersUrl = builder.serviceBindingParametersUrl;
this.serviceInstanceId = builder.serviceInstanceId;
this.serviceInstanceUrl = builder.serviceInstanceUrl;
this.syslogDrainUrl = builder.syslogDrainUrl;
this.volumeMounts = builder.volumeMounts == null ? null : createUnmodifiableList(true, builder.volumeMounts);
}
/**
* The application id
*/
@JsonProperty("app_guid")
@Override
public @Nullable String getApplicationId() {
return applicationId;
}
/**
* The application url
*/
@JsonProperty("app_url")
@Override
public @Nullable String getApplicationUrl() {
return applicationUrl;
}
/**
* The binding options
*/
@JsonProperty("binding_options")
@Override
public @Nullable Map getBindingOptions() {
return bindingOptions;
}
/**
* The credentials
*/
@JsonProperty("credentials")
@Override
public @Nullable Map getCredentials() {
return credentials;
}
/**
* The gateway data
*/
@JsonProperty("gateway_data")
@Deprecated
@Override
public @Nullable GatewayData getGatewayData() {
return gatewayData;
}
/**
* The gateway name
*/
@JsonProperty("gateway_name")
@Override
public @Nullable String getGatewayName() {
return gatewayName;
}
/**
* The last operation
*/
@JsonProperty("last_operation")
@Override
public @Nullable LastOperation getLastOperation() {
return lastOperation;
}
/**
* The service binding name
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* The service binding parameters url
*/
@JsonProperty("service_binding_parameters_url")
@Override
public @Nullable String getServiceBindingParametersUrl() {
return serviceBindingParametersUrl;
}
/**
* The service instance id
*/
@JsonProperty("service_instance_guid")
@Override
public @Nullable String getServiceInstanceId() {
return serviceInstanceId;
}
/**
* The service instance url
*/
@JsonProperty("service_instance_url")
@Override
public @Nullable String getServiceInstanceUrl() {
return serviceInstanceUrl;
}
/**
* The syslog drain url
*/
@JsonProperty("syslog_drain_url")
@Override
public @Nullable String getSyslogDrainUrl() {
return syslogDrainUrl;
}
/**
* The volume mounts
*/
@JsonProperty("volume_mounts")
@Override
public @Nullable List getVolumeMounts() {
return volumeMounts;
}
/**
* This instance is equal to all instances of {@code ServiceBindingEntity} 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 ServiceBindingEntity
&& equalTo(0, (ServiceBindingEntity) another);
}
private boolean equalTo(int synthetic, ServiceBindingEntity another) {
return Objects.equals(applicationId, another.applicationId)
&& Objects.equals(applicationUrl, another.applicationUrl)
&& Objects.equals(bindingOptions, another.bindingOptions)
&& Objects.equals(credentials, another.credentials)
&& Objects.equals(gatewayData, another.gatewayData)
&& Objects.equals(gatewayName, another.gatewayName)
&& Objects.equals(lastOperation, another.lastOperation)
&& Objects.equals(name, another.name)
&& Objects.equals(serviceBindingParametersUrl, another.serviceBindingParametersUrl)
&& Objects.equals(serviceInstanceId, another.serviceInstanceId)
&& Objects.equals(serviceInstanceUrl, another.serviceInstanceUrl)
&& Objects.equals(syslogDrainUrl, another.syslogDrainUrl)
&& Objects.equals(volumeMounts, another.volumeMounts);
}
/**
* Computes a hash code from attributes: {@code applicationId}, {@code applicationUrl}, {@code bindingOptions}, {@code credentials}, {@code gatewayData}, {@code gatewayName}, {@code lastOperation}, {@code name}, {@code serviceBindingParametersUrl}, {@code serviceInstanceId}, {@code serviceInstanceUrl}, {@code syslogDrainUrl}, {@code volumeMounts}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(applicationId);
h += (h << 5) + Objects.hashCode(applicationUrl);
h += (h << 5) + Objects.hashCode(bindingOptions);
h += (h << 5) + Objects.hashCode(credentials);
h += (h << 5) + Objects.hashCode(gatewayData);
h += (h << 5) + Objects.hashCode(gatewayName);
h += (h << 5) + Objects.hashCode(lastOperation);
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(serviceBindingParametersUrl);
h += (h << 5) + Objects.hashCode(serviceInstanceId);
h += (h << 5) + Objects.hashCode(serviceInstanceUrl);
h += (h << 5) + Objects.hashCode(syslogDrainUrl);
h += (h << 5) + Objects.hashCode(volumeMounts);
return h;
}
/**
* Prints the immutable value {@code ServiceBindingEntity} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "ServiceBindingEntity{"
+ "applicationId=" + applicationId
+ ", applicationUrl=" + applicationUrl
+ ", bindingOptions=" + bindingOptions
+ ", credentials=" + credentials
+ ", gatewayData=" + gatewayData
+ ", gatewayName=" + gatewayName
+ ", lastOperation=" + lastOperation
+ ", name=" + name
+ ", serviceBindingParametersUrl=" + serviceBindingParametersUrl
+ ", serviceInstanceId=" + serviceInstanceId
+ ", serviceInstanceUrl=" + serviceInstanceUrl
+ ", syslogDrainUrl=" + syslogDrainUrl
+ ", volumeMounts=" + volumeMounts
+ "}";
}
/**
* 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 = "_ServiceBindingEntity", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.client.v2.servicebindings._ServiceBindingEntity {
String applicationId;
String applicationUrl;
Map bindingOptions = null;
Map credentials = null;
GatewayData gatewayData;
String gatewayName;
LastOperation lastOperation;
String name;
String serviceBindingParametersUrl;
String serviceInstanceId;
String serviceInstanceUrl;
String syslogDrainUrl;
List volumeMounts = null;
@JsonProperty("app_guid")
public void setApplicationId(@Nullable String applicationId) {
this.applicationId = applicationId;
}
@JsonProperty("app_url")
public void setApplicationUrl(@Nullable String applicationUrl) {
this.applicationUrl = applicationUrl;
}
@JsonProperty("binding_options")
public void setBindingOptions(@Nullable Map bindingOptions) {
this.bindingOptions = bindingOptions;
}
@JsonProperty("credentials")
public void setCredentials(@Nullable Map credentials) {
this.credentials = credentials;
}
@JsonProperty("gateway_data")
public void setGatewayData(@Nullable GatewayData gatewayData) {
this.gatewayData = gatewayData;
}
@JsonProperty("gateway_name")
public void setGatewayName(@Nullable String gatewayName) {
this.gatewayName = gatewayName;
}
@JsonProperty("last_operation")
public void setLastOperation(@Nullable LastOperation lastOperation) {
this.lastOperation = lastOperation;
}
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("service_binding_parameters_url")
public void setServiceBindingParametersUrl(@Nullable String serviceBindingParametersUrl) {
this.serviceBindingParametersUrl = serviceBindingParametersUrl;
}
@JsonProperty("service_instance_guid")
public void setServiceInstanceId(@Nullable String serviceInstanceId) {
this.serviceInstanceId = serviceInstanceId;
}
@JsonProperty("service_instance_url")
public void setServiceInstanceUrl(@Nullable String serviceInstanceUrl) {
this.serviceInstanceUrl = serviceInstanceUrl;
}
@JsonProperty("syslog_drain_url")
public void setSyslogDrainUrl(@Nullable String syslogDrainUrl) {
this.syslogDrainUrl = syslogDrainUrl;
}
@JsonProperty("volume_mounts")
public void setVolumeMounts(@Nullable List volumeMounts) {
this.volumeMounts = volumeMounts;
}
@Override
public String getApplicationId() { throw new UnsupportedOperationException(); }
@Override
public String getApplicationUrl() { throw new UnsupportedOperationException(); }
@Override
public Map getBindingOptions() { throw new UnsupportedOperationException(); }
@Override
public Map getCredentials() { throw new UnsupportedOperationException(); }
@Override
public GatewayData getGatewayData() { throw new UnsupportedOperationException(); }
@Override
public String getGatewayName() { throw new UnsupportedOperationException(); }
@Override
public LastOperation getLastOperation() { throw new UnsupportedOperationException(); }
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public String getServiceBindingParametersUrl() { throw new UnsupportedOperationException(); }
@Override
public String getServiceInstanceId() { throw new UnsupportedOperationException(); }
@Override
public String getServiceInstanceUrl() { throw new UnsupportedOperationException(); }
@Override
public String getSyslogDrainUrl() { throw new UnsupportedOperationException(); }
@Override
public List getVolumeMounts() { 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 ServiceBindingEntity fromJson(Json json) {
ServiceBindingEntity.Builder builder = ServiceBindingEntity.builder();
if (json.applicationId != null) {
builder.applicationId(json.applicationId);
}
if (json.applicationUrl != null) {
builder.applicationUrl(json.applicationUrl);
}
if (json.bindingOptions != null) {
builder.putAllBindingOptions(json.bindingOptions);
}
if (json.credentials != null) {
builder.putAllCredentials(json.credentials);
}
if (json.gatewayData != null) {
builder.gatewayData(json.gatewayData);
}
if (json.gatewayName != null) {
builder.gatewayName(json.gatewayName);
}
if (json.lastOperation != null) {
builder.lastOperation(json.lastOperation);
}
if (json.name != null) {
builder.name(json.name);
}
if (json.serviceBindingParametersUrl != null) {
builder.serviceBindingParametersUrl(json.serviceBindingParametersUrl);
}
if (json.serviceInstanceId != null) {
builder.serviceInstanceId(json.serviceInstanceId);
}
if (json.serviceInstanceUrl != null) {
builder.serviceInstanceUrl(json.serviceInstanceUrl);
}
if (json.syslogDrainUrl != null) {
builder.syslogDrainUrl(json.syslogDrainUrl);
}
if (json.volumeMounts != null) {
builder.addAllVolumeMounts(json.volumeMounts);
}
return builder.build();
}
/**
* Creates a builder for {@link ServiceBindingEntity ServiceBindingEntity}.
*
* ServiceBindingEntity.builder()
* .applicationId(String | null) // nullable {@link ServiceBindingEntity#getApplicationId() applicationId}
* .applicationUrl(String | null) // nullable {@link ServiceBindingEntity#getApplicationUrl() applicationUrl}
* .bindingOptions(Map<String, Object> | null) // nullable {@link ServiceBindingEntity#getBindingOptions() bindingOptions}
* .credentials(Map<String, Object> | null) // nullable {@link ServiceBindingEntity#getCredentials() credentials}
* .gatewayData(org.cloudfoundry.client.v2.serviceinstances.GatewayData | null) // nullable {@link ServiceBindingEntity#getGatewayData() gatewayData}
* .gatewayName(String | null) // nullable {@link ServiceBindingEntity#getGatewayName() gatewayName}
* .lastOperation(org.cloudfoundry.client.v2.servicebindings.LastOperation | null) // nullable {@link ServiceBindingEntity#getLastOperation() lastOperation}
* .name(String | null) // nullable {@link ServiceBindingEntity#getName() name}
* .serviceBindingParametersUrl(String | null) // nullable {@link ServiceBindingEntity#getServiceBindingParametersUrl() serviceBindingParametersUrl}
* .serviceInstanceId(String | null) // nullable {@link ServiceBindingEntity#getServiceInstanceId() serviceInstanceId}
* .serviceInstanceUrl(String | null) // nullable {@link ServiceBindingEntity#getServiceInstanceUrl() serviceInstanceUrl}
* .syslogDrainUrl(String | null) // nullable {@link ServiceBindingEntity#getSyslogDrainUrl() syslogDrainUrl}
* .volumeMounts(List<VolumeMounts> | null) // nullable {@link ServiceBindingEntity#getVolumeMounts() volumeMounts}
* .build();
*
* @return A new ServiceBindingEntity builder
*/
public static ServiceBindingEntity.Builder builder() {
return new ServiceBindingEntity.Builder();
}
/**
* Builds instances of type {@link ServiceBindingEntity ServiceBindingEntity}.
* 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 = "_ServiceBindingEntity", generator = "Immutables")
public static final class Builder {
private String applicationId;
private String applicationUrl;
private Map bindingOptions = null;
private Map credentials = null;
private GatewayData gatewayData;
private String gatewayName;
private LastOperation lastOperation;
private String name;
private String serviceBindingParametersUrl;
private String serviceInstanceId;
private String serviceInstanceUrl;
private String syslogDrainUrl;
private List volumeMounts = null;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code ServiceBindingEntity} 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(ServiceBindingEntity instance) {
return from((_ServiceBindingEntity) instance);
}
/**
* Copy abstract value type {@code _ServiceBindingEntity} 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(_ServiceBindingEntity instance) {
Objects.requireNonNull(instance, "instance");
String applicationIdValue = instance.getApplicationId();
if (applicationIdValue != null) {
applicationId(applicationIdValue);
}
String applicationUrlValue = instance.getApplicationUrl();
if (applicationUrlValue != null) {
applicationUrl(applicationUrlValue);
}
Map bindingOptionsValue = instance.getBindingOptions();
if (bindingOptionsValue != null) {
putAllBindingOptions(bindingOptionsValue);
}
Map credentialsValue = instance.getCredentials();
if (credentialsValue != null) {
putAllCredentials(credentialsValue);
}
GatewayData gatewayDataValue = instance.getGatewayData();
if (gatewayDataValue != null) {
gatewayData(gatewayDataValue);
}
String gatewayNameValue = instance.getGatewayName();
if (gatewayNameValue != null) {
gatewayName(gatewayNameValue);
}
LastOperation lastOperationValue = instance.getLastOperation();
if (lastOperationValue != null) {
lastOperation(lastOperationValue);
}
String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
String serviceBindingParametersUrlValue = instance.getServiceBindingParametersUrl();
if (serviceBindingParametersUrlValue != null) {
serviceBindingParametersUrl(serviceBindingParametersUrlValue);
}
String serviceInstanceIdValue = instance.getServiceInstanceId();
if (serviceInstanceIdValue != null) {
serviceInstanceId(serviceInstanceIdValue);
}
String serviceInstanceUrlValue = instance.getServiceInstanceUrl();
if (serviceInstanceUrlValue != null) {
serviceInstanceUrl(serviceInstanceUrlValue);
}
String syslogDrainUrlValue = instance.getSyslogDrainUrl();
if (syslogDrainUrlValue != null) {
syslogDrainUrl(syslogDrainUrlValue);
}
List volumeMountsValue = instance.getVolumeMounts();
if (volumeMountsValue != null) {
addAllVolumeMounts(volumeMountsValue);
}
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getApplicationId() applicationId} attribute.
* @param applicationId The value for applicationId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("app_guid")
public final Builder applicationId(@Nullable String applicationId) {
this.applicationId = applicationId;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getApplicationUrl() applicationUrl} attribute.
* @param applicationUrl The value for applicationUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("app_url")
public final Builder applicationUrl(@Nullable String applicationUrl) {
this.applicationUrl = applicationUrl;
return this;
}
/**
* Put one entry to the {@link ServiceBindingEntity#getBindingOptions() bindingOptions} map.
* @param key The key in the bindingOptions map
* @param value The associated value in the bindingOptions map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder bindingOption(String key, Object value) {
if (this.bindingOptions == null) {
this.bindingOptions = new LinkedHashMap();
}
this.bindingOptions.put(key, value);
return this;
}
/**
* Put one entry to the {@link ServiceBindingEntity#getBindingOptions() bindingOptions} 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 bindingOption(Map.Entry entry) {
if (this.bindingOptions == null) {
this.bindingOptions = new LinkedHashMap();
}
String k = entry.getKey();
Object v = entry.getValue();
this.bindingOptions.put(k, v);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link ServiceBindingEntity#getBindingOptions() bindingOptions} 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 bindingOptions map
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("binding_options")
public final Builder bindingOptions(@Nullable Map entries) {
if (entries == null) {
this.bindingOptions = null;
return this;
}
this.bindingOptions = new LinkedHashMap();
return putAllBindingOptions(entries);
}
/**
* Put all mappings from the specified map as entries to {@link ServiceBindingEntity#getBindingOptions() bindingOptions} map. Nulls are not permitted
* @param entries The entries that will be added to the bindingOptions map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder putAllBindingOptions(Map entries) {
if (this.bindingOptions == null) {
this.bindingOptions = new LinkedHashMap();
}
for (Map.Entry e : entries.entrySet()) {
String k = e.getKey();
Object v = e.getValue();
this.bindingOptions.put(k, v);
}
return this;
}
/**
* Put one entry to the {@link ServiceBindingEntity#getCredentials() credentials} map.
* @param key The key in the credentials map
* @param value The associated value in the credentials map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder credential(String key, Object value) {
if (this.credentials == null) {
this.credentials = new LinkedHashMap();
}
this.credentials.put(key, value);
return this;
}
/**
* Put one entry to the {@link ServiceBindingEntity#getCredentials() credentials} 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 credential(Map.Entry entry) {
if (this.credentials == null) {
this.credentials = new LinkedHashMap();
}
String k = entry.getKey();
Object v = entry.getValue();
this.credentials.put(k, v);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link ServiceBindingEntity#getCredentials() credentials} 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 credentials map
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("credentials")
public final Builder credentials(@Nullable Map entries) {
if (entries == null) {
this.credentials = null;
return this;
}
this.credentials = new LinkedHashMap();
return putAllCredentials(entries);
}
/**
* Put all mappings from the specified map as entries to {@link ServiceBindingEntity#getCredentials() credentials} map. Nulls are not permitted
* @param entries The entries that will be added to the credentials map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder putAllCredentials(Map entries) {
if (this.credentials == null) {
this.credentials = new LinkedHashMap();
}
for (Map.Entry e : entries.entrySet()) {
String k = e.getKey();
Object v = e.getValue();
this.credentials.put(k, v);
}
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getGatewayData() gatewayData} attribute.
* @param gatewayData The value for gatewayData (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("gateway_data")
@Deprecated
public final Builder gatewayData(@Nullable GatewayData gatewayData) {
this.gatewayData = gatewayData;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getGatewayName() gatewayName} attribute.
* @param gatewayName The value for gatewayName (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("gateway_name")
public final Builder gatewayName(@Nullable String gatewayName) {
this.gatewayName = gatewayName;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getLastOperation() lastOperation} attribute.
* @param lastOperation The value for lastOperation (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("last_operation")
public final Builder lastOperation(@Nullable LastOperation lastOperation) {
this.lastOperation = lastOperation;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#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 ServiceBindingEntity#getServiceBindingParametersUrl() serviceBindingParametersUrl} attribute.
* @param serviceBindingParametersUrl The value for serviceBindingParametersUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("service_binding_parameters_url")
public final Builder serviceBindingParametersUrl(@Nullable String serviceBindingParametersUrl) {
this.serviceBindingParametersUrl = serviceBindingParametersUrl;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getServiceInstanceId() serviceInstanceId} attribute.
* @param serviceInstanceId The value for serviceInstanceId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("service_instance_guid")
public final Builder serviceInstanceId(@Nullable String serviceInstanceId) {
this.serviceInstanceId = serviceInstanceId;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getServiceInstanceUrl() serviceInstanceUrl} attribute.
* @param serviceInstanceUrl The value for serviceInstanceUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("service_instance_url")
public final Builder serviceInstanceUrl(@Nullable String serviceInstanceUrl) {
this.serviceInstanceUrl = serviceInstanceUrl;
return this;
}
/**
* Initializes the value for the {@link ServiceBindingEntity#getSyslogDrainUrl() syslogDrainUrl} attribute.
* @param syslogDrainUrl The value for syslogDrainUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("syslog_drain_url")
public final Builder syslogDrainUrl(@Nullable String syslogDrainUrl) {
this.syslogDrainUrl = syslogDrainUrl;
return this;
}
/**
* Adds one element to {@link ServiceBindingEntity#getVolumeMounts() volumeMounts} list.
* @param element A volumeMounts element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder volumeMount(VolumeMounts element) {
if (this.volumeMounts == null) {
this.volumeMounts = new ArrayList();
}
this.volumeMounts.add(Objects.requireNonNull(element, "volumeMounts element"));
return this;
}
/**
* Adds elements to {@link ServiceBindingEntity#getVolumeMounts() volumeMounts} list.
* @param elements An array of volumeMounts elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder volumeMounts(VolumeMounts... elements) {
if (this.volumeMounts == null) {
this.volumeMounts = new ArrayList();
}
for (VolumeMounts element : elements) {
this.volumeMounts.add(Objects.requireNonNull(element, "volumeMounts element"));
}
return this;
}
/**
* Sets or replaces all elements for {@link ServiceBindingEntity#getVolumeMounts() volumeMounts} list.
* @param elements An iterable of volumeMounts elements
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("volume_mounts")
public final Builder volumeMounts(@Nullable Iterable extends VolumeMounts> elements) {
if (elements == null) {
this.volumeMounts = null;
return this;
}
this.volumeMounts = new ArrayList();
return addAllVolumeMounts(elements);
}
/**
* Adds elements to {@link ServiceBindingEntity#getVolumeMounts() volumeMounts} list.
* @param elements An iterable of volumeMounts elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllVolumeMounts(Iterable extends VolumeMounts> elements) {
Objects.requireNonNull(elements, "volumeMounts element");
if (this.volumeMounts == null) {
this.volumeMounts = new ArrayList();
}
for (VolumeMounts element : elements) {
this.volumeMounts.add(Objects.requireNonNull(element, "volumeMounts element"));
}
return this;
}
/**
* Builds a new {@link ServiceBindingEntity ServiceBindingEntity}.
* @return An immutable instance of ServiceBindingEntity
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ServiceBindingEntity build() {
return new ServiceBindingEntity(this);
}
}
private static List createSafeList(Iterable extends T> iterable, boolean checkNulls, boolean skipNulls) {
ArrayList list;
if (iterable instanceof Collection>) {
int size = ((Collection>) iterable).size();
if (size == 0) return Collections.emptyList();
list = new ArrayList<>(size);
} else {
list = new ArrayList<>();
}
for (T element : iterable) {
if (skipNulls && element == null) continue;
if (checkNulls) Objects.requireNonNull(element, "element");
list.add(element);
}
return list;
}
private static List createUnmodifiableList(boolean clone, List list) {
switch(list.size()) {
case 0: return Collections.emptyList();
case 1: return Collections.singletonList(list.get(0));
default:
if (clone) {
return Collections.unmodifiableList(new ArrayList<>(list));
} else {
if (list instanceof ArrayList>) {
((ArrayList>) list).trimToSize();
}
return Collections.unmodifiableList(list);
}
}
}
private static Map createUnmodifiableMap(boolean checkNulls, boolean skipNulls, Map extends K, ? extends V> map) {
switch (map.size()) {
case 0: return Collections.emptyMap();
case 1: {
Map.Entry extends K, ? extends V> 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 extends K, ? extends V> 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);
}
}
}
}