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

org.cloudfoundry.multiapps.controller.persistence.model.ImmutableOperationLogEntry Maven / Gradle / Ivy

package org.cloudfoundry.multiapps.controller.persistence.model;

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.time.LocalDateTime;
import java.util.Objects;
import org.cloudfoundry.multiapps.common.Nullable;

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

* Use the builder to create immutable instances: * {@code ImmutableOperationLogEntry.builder()}. */ @SuppressWarnings({"all"}) public final class ImmutableOperationLogEntry implements OperationLogEntry { private final @Nullable String id; private final @Nullable String space; private final @Nullable String namespace; private final @Nullable LocalDateTime modified; private final @Nullable String operationId; private final @Nullable String operationLog; private final @Nullable String operationLogName; private ImmutableOperationLogEntry( @Nullable String id, @Nullable String space, @Nullable String namespace, @Nullable LocalDateTime modified, @Nullable String operationId, @Nullable String operationLog, @Nullable String operationLogName) { this.id = id; this.space = space; this.namespace = namespace; this.modified = modified; this.operationId = operationId; this.operationLog = operationLog; this.operationLogName = operationLogName; } /** * @return The value of the {@code id} attribute */ @JsonProperty("id") @Override public @Nullable String getId() { return id; } /** * @return The value of the {@code space} attribute */ @JsonProperty("space") @Override public @Nullable String getSpace() { return space; } /** * @return The value of the {@code namespace} attribute */ @JsonProperty("namespace") @Override public @Nullable String getNamespace() { return namespace; } /** * @return The value of the {@code modified} attribute */ @JsonProperty("modified") @Override public @Nullable LocalDateTime getModified() { return modified; } /** * @return The value of the {@code operationId} attribute */ @JsonProperty("operationId") @Override public @Nullable String getOperationId() { return operationId; } /** * @return The value of the {@code operationLog} attribute */ @JsonProperty("operationLog") @Override public @Nullable String getOperationLog() { return operationLog; } /** * @return The value of the {@code operationLogName} attribute */ @JsonProperty("operationLogName") @Override public @Nullable String getOperationLogName() { return operationLogName; } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getId() id} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for id (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withId(@Nullable String value) { if (Objects.equals(this.id, value)) return this; return new ImmutableOperationLogEntry( value, this.space, this.namespace, this.modified, this.operationId, this.operationLog, this.operationLogName); } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getSpace() space} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for space (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withSpace(@Nullable String value) { if (Objects.equals(this.space, value)) return this; return new ImmutableOperationLogEntry( this.id, value, this.namespace, this.modified, this.operationId, this.operationLog, this.operationLogName); } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getNamespace() namespace} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for namespace (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withNamespace(@Nullable String value) { if (Objects.equals(this.namespace, value)) return this; return new ImmutableOperationLogEntry( this.id, this.space, value, this.modified, this.operationId, this.operationLog, this.operationLogName); } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getModified() modified} 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 modified (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withModified(@Nullable LocalDateTime value) { if (this.modified == value) return this; return new ImmutableOperationLogEntry( this.id, this.space, this.namespace, value, this.operationId, this.operationLog, this.operationLogName); } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getOperationId() operationId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for operationId (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withOperationId(@Nullable String value) { if (Objects.equals(this.operationId, value)) return this; return new ImmutableOperationLogEntry( this.id, this.space, this.namespace, this.modified, value, this.operationLog, this.operationLogName); } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getOperationLog() operationLog} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for operationLog (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withOperationLog(@Nullable String value) { if (Objects.equals(this.operationLog, value)) return this; return new ImmutableOperationLogEntry( this.id, this.space, this.namespace, this.modified, this.operationId, value, this.operationLogName); } /** * Copy the current immutable object by setting a value for the {@link OperationLogEntry#getOperationLogName() operationLogName} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for operationLogName (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableOperationLogEntry withOperationLogName(@Nullable String value) { if (Objects.equals(this.operationLogName, value)) return this; return new ImmutableOperationLogEntry(this.id, this.space, this.namespace, this.modified, this.operationId, this.operationLog, value); } /** * This instance is equal to all instances of {@code ImmutableOperationLogEntry} 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 ImmutableOperationLogEntry && equalTo(0, (ImmutableOperationLogEntry) another); } private boolean equalTo(int synthetic, ImmutableOperationLogEntry another) { return Objects.equals(id, another.id) && Objects.equals(space, another.space) && Objects.equals(namespace, another.namespace) && Objects.equals(modified, another.modified) && Objects.equals(operationId, another.operationId) && Objects.equals(operationLog, another.operationLog) && Objects.equals(operationLogName, another.operationLogName); } /** * Computes a hash code from attributes: {@code id}, {@code space}, {@code namespace}, {@code modified}, {@code operationId}, {@code operationLog}, {@code operationLogName}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(id); h += (h << 5) + Objects.hashCode(space); h += (h << 5) + Objects.hashCode(namespace); h += (h << 5) + Objects.hashCode(modified); h += (h << 5) + Objects.hashCode(operationId); h += (h << 5) + Objects.hashCode(operationLog); h += (h << 5) + Objects.hashCode(operationLogName); return h; } /** * Prints the immutable value {@code OperationLogEntry} with attribute values. * @return A string representation of the value */ @Override public String toString() { return "OperationLogEntry{" + "id=" + id + ", space=" + space + ", namespace=" + namespace + ", modified=" + modified + ", operationId=" + operationId + ", operationLog=" + operationLog + ", operationLogName=" + operationLogName + "}"; } /** * 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 */ @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements OperationLogEntry { String id; String space; String namespace; LocalDateTime modified; String operationId; String operationLog; String operationLogName; @JsonProperty("id") public void setId(@Nullable String id) { this.id = id; } @JsonProperty("space") public void setSpace(@Nullable String space) { this.space = space; } @JsonProperty("namespace") public void setNamespace(@Nullable String namespace) { this.namespace = namespace; } @JsonProperty("modified") public void setModified(@Nullable LocalDateTime modified) { this.modified = modified; } @JsonProperty("operationId") public void setOperationId(@Nullable String operationId) { this.operationId = operationId; } @JsonProperty("operationLog") public void setOperationLog(@Nullable String operationLog) { this.operationLog = operationLog; } @JsonProperty("operationLogName") public void setOperationLogName(@Nullable String operationLogName) { this.operationLogName = operationLogName; } @Override public String getId() { throw new UnsupportedOperationException(); } @Override public String getSpace() { throw new UnsupportedOperationException(); } @Override public String getNamespace() { throw new UnsupportedOperationException(); } @Override public LocalDateTime getModified() { throw new UnsupportedOperationException(); } @Override public String getOperationId() { throw new UnsupportedOperationException(); } @Override public String getOperationLog() { throw new UnsupportedOperationException(); } @Override public String getOperationLogName() { 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 ImmutableOperationLogEntry fromJson(Json json) { ImmutableOperationLogEntry.Builder builder = ImmutableOperationLogEntry.builder(); if (json.id != null) { builder.id(json.id); } if (json.space != null) { builder.space(json.space); } if (json.namespace != null) { builder.namespace(json.namespace); } if (json.modified != null) { builder.modified(json.modified); } if (json.operationId != null) { builder.operationId(json.operationId); } if (json.operationLog != null) { builder.operationLog(json.operationLog); } if (json.operationLogName != null) { builder.operationLogName(json.operationLogName); } return builder.build(); } /** * Creates an immutable copy of a {@link OperationLogEntry} 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 OperationLogEntry instance */ public static ImmutableOperationLogEntry copyOf(OperationLogEntry instance) { if (instance instanceof ImmutableOperationLogEntry) { return (ImmutableOperationLogEntry) instance; } return ImmutableOperationLogEntry.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableOperationLogEntry ImmutableOperationLogEntry}. *

   * ImmutableOperationLogEntry.builder()
   *    .id(String | null) // nullable {@link OperationLogEntry#getId() id}
   *    .space(String | null) // nullable {@link OperationLogEntry#getSpace() space}
   *    .namespace(String | null) // nullable {@link OperationLogEntry#getNamespace() namespace}
   *    .modified(java.time.LocalDateTime | null) // nullable {@link OperationLogEntry#getModified() modified}
   *    .operationId(String | null) // nullable {@link OperationLogEntry#getOperationId() operationId}
   *    .operationLog(String | null) // nullable {@link OperationLogEntry#getOperationLog() operationLog}
   *    .operationLogName(String | null) // nullable {@link OperationLogEntry#getOperationLogName() operationLogName}
   *    .build();
   * 
* @return A new ImmutableOperationLogEntry builder */ public static ImmutableOperationLogEntry.Builder builder() { return new ImmutableOperationLogEntry.Builder(); } /** * Builds instances of type {@link ImmutableOperationLogEntry ImmutableOperationLogEntry}. * 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. */ public static final class Builder { private String id; private String space; private String namespace; private LocalDateTime modified; private String operationId; private String operationLog; private String operationLogName; private Builder() { } /** * Fill a builder with attribute values from the provided {@code OperationLogEntry} 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(OperationLogEntry instance) { Objects.requireNonNull(instance, "instance"); @Nullable String idValue = instance.getId(); if (idValue != null) { id(idValue); } @Nullable String spaceValue = instance.getSpace(); if (spaceValue != null) { space(spaceValue); } @Nullable String namespaceValue = instance.getNamespace(); if (namespaceValue != null) { namespace(namespaceValue); } @Nullable LocalDateTime modifiedValue = instance.getModified(); if (modifiedValue != null) { modified(modifiedValue); } @Nullable String operationIdValue = instance.getOperationId(); if (operationIdValue != null) { operationId(operationIdValue); } @Nullable String operationLogValue = instance.getOperationLog(); if (operationLogValue != null) { operationLog(operationLogValue); } @Nullable String operationLogNameValue = instance.getOperationLogName(); if (operationLogNameValue != null) { operationLogName(operationLogNameValue); } return this; } /** * Initializes the value for the {@link OperationLogEntry#getId() id} attribute. * @param id The value for id (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("id") public final Builder id(@Nullable String id) { this.id = id; return this; } /** * Initializes the value for the {@link OperationLogEntry#getSpace() space} attribute. * @param space The value for space (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("space") public final Builder space(@Nullable String space) { this.space = space; return this; } /** * Initializes the value for the {@link OperationLogEntry#getNamespace() namespace} attribute. * @param namespace The value for namespace (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("namespace") public final Builder namespace(@Nullable String namespace) { this.namespace = namespace; return this; } /** * Initializes the value for the {@link OperationLogEntry#getModified() modified} attribute. * @param modified The value for modified (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("modified") public final Builder modified(@Nullable LocalDateTime modified) { this.modified = modified; return this; } /** * Initializes the value for the {@link OperationLogEntry#getOperationId() operationId} attribute. * @param operationId The value for operationId (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("operationId") public final Builder operationId(@Nullable String operationId) { this.operationId = operationId; return this; } /** * Initializes the value for the {@link OperationLogEntry#getOperationLog() operationLog} attribute. * @param operationLog The value for operationLog (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("operationLog") public final Builder operationLog(@Nullable String operationLog) { this.operationLog = operationLog; return this; } /** * Initializes the value for the {@link OperationLogEntry#getOperationLogName() operationLogName} attribute. * @param operationLogName The value for operationLogName (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @JsonProperty("operationLogName") public final Builder operationLogName(@Nullable String operationLogName) { this.operationLogName = operationLogName; return this; } /** * Builds a new {@link ImmutableOperationLogEntry ImmutableOperationLogEntry}. * @return An immutable instance of OperationLogEntry * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableOperationLogEntry build() { return new ImmutableOperationLogEntry(id, space, namespace, modified, operationId, operationLog, operationLogName); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy