org.cloudfoundry.client.lib.domain.ImmutableCloudEvent Maven / Gradle / Ivy
Show all versions of cloudfoundry-client-lib Show documentation
package org.cloudfoundry.client.lib.domain;
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.Date;
import java.util.Objects;
import java.util.UUID;
import org.cloudfoundry.client.lib.domain.annotation.Nullable;
import org.cloudfoundry.client.v3.Metadata;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link CloudEvent}.
*
* Use the builder to create immutable instances:
* {@code ImmutableCloudEvent.builder()}.
*/
@Generated(from = "CloudEvent", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableCloudEvent extends CloudEvent {
private final @Nullable String name;
private final @Nullable CloudMetadata metadata;
private final @Nullable Metadata v3Metadata;
private final @Nullable String type;
private final @Nullable CloudEvent.Participant actor;
private final @Nullable CloudEvent.Participant actee;
private final @Nullable Date timestamp;
private ImmutableCloudEvent(
@Nullable String name,
@Nullable CloudMetadata metadata,
@Nullable Metadata v3Metadata,
@Nullable String type,
@Nullable CloudEvent.Participant actor,
@Nullable CloudEvent.Participant actee,
@Nullable Date timestamp) {
this.name = name;
this.metadata = metadata;
this.v3Metadata = v3Metadata;
this.type = type;
this.actor = actor;
this.actee = actee;
this.timestamp = timestamp;
}
/**
* @return The value of the {@code name} attribute
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* @return The value of the {@code metadata} attribute
*/
@JsonProperty("metadata")
@Override
public @Nullable CloudMetadata getMetadata() {
return metadata;
}
/**
* @return The value of the {@code v3Metadata} attribute
*/
@JsonProperty("v3Metadata")
@Override
public @Nullable Metadata getV3Metadata() {
return v3Metadata;
}
/**
* @return The value of the {@code type} attribute
*/
@JsonProperty("type")
@Override
public @Nullable String getType() {
return type;
}
/**
* @return The value of the {@code actor} attribute
*/
@JsonProperty("actor")
@Override
public @Nullable CloudEvent.Participant getActor() {
return actor;
}
/**
* @return The value of the {@code actee} attribute
*/
@JsonProperty("actee")
@Override
public @Nullable CloudEvent.Participant getActee() {
return actee;
}
/**
* @return The value of the {@code timestamp} attribute
*/
@JsonProperty("timestamp")
@Override
public @Nullable Date getTimestamp() {
return timestamp;
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getName() name} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for name (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withName(@Nullable String value) {
if (Objects.equals(this.name, value)) return this;
return new ImmutableCloudEvent(value, this.metadata, this.v3Metadata, this.type, this.actor, this.actee, this.timestamp);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getMetadata() metadata} 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 metadata (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withMetadata(@Nullable CloudMetadata value) {
if (this.metadata == value) return this;
return new ImmutableCloudEvent(this.name, value, this.v3Metadata, this.type, this.actor, this.actee, this.timestamp);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getV3Metadata() v3Metadata} 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 v3Metadata (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withV3Metadata(@Nullable Metadata value) {
if (this.v3Metadata == value) return this;
return new ImmutableCloudEvent(this.name, this.metadata, value, this.type, this.actor, this.actee, this.timestamp);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getType() type} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for type (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withType(@Nullable String value) {
if (Objects.equals(this.type, value)) return this;
return new ImmutableCloudEvent(this.name, this.metadata, this.v3Metadata, value, this.actor, this.actee, this.timestamp);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getActor() actor} 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 actor (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withActor(@Nullable CloudEvent.Participant value) {
if (this.actor == value) return this;
return new ImmutableCloudEvent(this.name, this.metadata, this.v3Metadata, this.type, value, this.actee, this.timestamp);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getActee() actee} 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 actee (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withActee(@Nullable CloudEvent.Participant value) {
if (this.actee == value) return this;
return new ImmutableCloudEvent(this.name, this.metadata, this.v3Metadata, this.type, this.actor, value, this.timestamp);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent#getTimestamp() timestamp} 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 timestamp (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent withTimestamp(@Nullable Date value) {
if (this.timestamp == value) return this;
return new ImmutableCloudEvent(this.name, this.metadata, this.v3Metadata, this.type, this.actor, this.actee, value);
}
/**
* This instance is equal to all instances of {@code ImmutableCloudEvent} 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 ImmutableCloudEvent
&& equalTo((ImmutableCloudEvent) another);
}
private boolean equalTo(ImmutableCloudEvent another) {
return Objects.equals(name, another.name)
&& Objects.equals(metadata, another.metadata)
&& Objects.equals(v3Metadata, another.v3Metadata)
&& Objects.equals(type, another.type)
&& Objects.equals(actor, another.actor)
&& Objects.equals(actee, another.actee)
&& Objects.equals(timestamp, another.timestamp);
}
/**
* Computes a hash code from attributes: {@code name}, {@code metadata}, {@code v3Metadata}, {@code type}, {@code actor}, {@code actee}, {@code timestamp}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(metadata);
h += (h << 5) + Objects.hashCode(v3Metadata);
h += (h << 5) + Objects.hashCode(type);
h += (h << 5) + Objects.hashCode(actor);
h += (h << 5) + Objects.hashCode(actee);
h += (h << 5) + Objects.hashCode(timestamp);
return h;
}
/**
* Prints the immutable value {@code CloudEvent} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "CloudEvent{"
+ "name=" + name
+ ", metadata=" + metadata
+ ", v3Metadata=" + v3Metadata
+ ", type=" + type
+ ", actor=" + actor
+ ", actee=" + actee
+ ", timestamp=" + timestamp
+ "}";
}
/**
* 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 = "CloudEvent", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends CloudEvent {
String name;
CloudMetadata metadata;
Metadata v3Metadata;
String type;
CloudEvent.Participant actor;
CloudEvent.Participant actee;
Date timestamp;
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("metadata")
public void setMetadata(@Nullable CloudMetadata metadata) {
this.metadata = metadata;
}
@JsonProperty("v3Metadata")
public void setV3Metadata(@Nullable Metadata v3Metadata) {
this.v3Metadata = v3Metadata;
}
@JsonProperty("type")
public void setType(@Nullable String type) {
this.type = type;
}
@JsonProperty("actor")
public void setActor(@Nullable CloudEvent.Participant actor) {
this.actor = actor;
}
@JsonProperty("actee")
public void setActee(@Nullable CloudEvent.Participant actee) {
this.actee = actee;
}
@JsonProperty("timestamp")
public void setTimestamp(@Nullable Date timestamp) {
this.timestamp = timestamp;
}
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public CloudMetadata getMetadata() { throw new UnsupportedOperationException(); }
@Override
public Metadata getV3Metadata() { throw new UnsupportedOperationException(); }
@Override
public String getType() { throw new UnsupportedOperationException(); }
@Override
public CloudEvent.Participant getActor() { throw new UnsupportedOperationException(); }
@Override
public CloudEvent.Participant getActee() { throw new UnsupportedOperationException(); }
@Override
public Date getTimestamp() { 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 ImmutableCloudEvent fromJson(Json json) {
ImmutableCloudEvent.Builder builder = ImmutableCloudEvent.builder();
if (json.name != null) {
builder.name(json.name);
}
if (json.metadata != null) {
builder.metadata(json.metadata);
}
if (json.v3Metadata != null) {
builder.v3Metadata(json.v3Metadata);
}
if (json.type != null) {
builder.type(json.type);
}
if (json.actor != null) {
builder.actor(json.actor);
}
if (json.actee != null) {
builder.actee(json.actee);
}
if (json.timestamp != null) {
builder.timestamp(json.timestamp);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link CloudEvent} 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 CloudEvent instance
*/
public static ImmutableCloudEvent copyOf(CloudEvent instance) {
if (instance instanceof ImmutableCloudEvent) {
return (ImmutableCloudEvent) instance;
}
return ImmutableCloudEvent.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableCloudEvent ImmutableCloudEvent}.
*
* ImmutableCloudEvent.builder()
* .name(String | null) // nullable {@link CloudEvent#getName() name}
* .metadata(org.cloudfoundry.client.lib.domain.CloudMetadata | null) // nullable {@link CloudEvent#getMetadata() metadata}
* .v3Metadata(org.cloudfoundry.client.v3.Metadata | null) // nullable {@link CloudEvent#getV3Metadata() v3Metadata}
* .type(String | null) // nullable {@link CloudEvent#getType() type}
* .actor(org.cloudfoundry.client.lib.domain.CloudEvent.Participant | null) // nullable {@link CloudEvent#getActor() actor}
* .actee(org.cloudfoundry.client.lib.domain.CloudEvent.Participant | null) // nullable {@link CloudEvent#getActee() actee}
* .timestamp(Date | null) // nullable {@link CloudEvent#getTimestamp() timestamp}
* .build();
*
* @return A new ImmutableCloudEvent builder
*/
public static ImmutableCloudEvent.Builder builder() {
return new ImmutableCloudEvent.Builder();
}
/**
* Builds instances of type {@link ImmutableCloudEvent ImmutableCloudEvent}.
* 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 = "CloudEvent", generator = "Immutables")
public static final class Builder {
private String name;
private CloudMetadata metadata;
private Metadata v3Metadata;
private String type;
private CloudEvent.Participant actor;
private CloudEvent.Participant actee;
private Date timestamp;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.lib.domain.CloudEntity} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(CloudEntity instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.lib.domain.CloudEvent} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(CloudEvent instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
private void from(Object object) {
if (object instanceof CloudEntity) {
CloudEntity instance = (CloudEntity) object;
@Nullable String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
@Nullable Metadata v3MetadataValue = instance.getV3Metadata();
if (v3MetadataValue != null) {
v3Metadata(v3MetadataValue);
}
@Nullable CloudMetadata metadataValue = instance.getMetadata();
if (metadataValue != null) {
metadata(metadataValue);
}
}
if (object instanceof CloudEvent) {
CloudEvent instance = (CloudEvent) object;
@Nullable CloudEvent.Participant actorValue = instance.getActor();
if (actorValue != null) {
actor(actorValue);
}
@Nullable String typeValue = instance.getType();
if (typeValue != null) {
type(typeValue);
}
@Nullable CloudEvent.Participant acteeValue = instance.getActee();
if (acteeValue != null) {
actee(acteeValue);
}
@Nullable Date timestampValue = instance.getTimestamp();
if (timestampValue != null) {
timestamp(timestampValue);
}
}
}
/**
* Initializes the value for the {@link CloudEvent#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 CloudEvent#getMetadata() metadata} attribute.
* @param metadata The value for metadata (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("metadata")
public final Builder metadata(@Nullable CloudMetadata metadata) {
this.metadata = metadata;
return this;
}
/**
* Initializes the value for the {@link CloudEvent#getV3Metadata() v3Metadata} attribute.
* @param v3Metadata The value for v3Metadata (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("v3Metadata")
public final Builder v3Metadata(@Nullable Metadata v3Metadata) {
this.v3Metadata = v3Metadata;
return this;
}
/**
* Initializes the value for the {@link CloudEvent#getType() type} attribute.
* @param type The value for type (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("type")
public final Builder type(@Nullable String type) {
this.type = type;
return this;
}
/**
* Initializes the value for the {@link CloudEvent#getActor() actor} attribute.
* @param actor The value for actor (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("actor")
public final Builder actor(@Nullable CloudEvent.Participant actor) {
this.actor = actor;
return this;
}
/**
* Initializes the value for the {@link CloudEvent#getActee() actee} attribute.
* @param actee The value for actee (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("actee")
public final Builder actee(@Nullable CloudEvent.Participant actee) {
this.actee = actee;
return this;
}
/**
* Initializes the value for the {@link CloudEvent#getTimestamp() timestamp} attribute.
* @param timestamp The value for timestamp (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("timestamp")
public final Builder timestamp(@Nullable Date timestamp) {
this.timestamp = timestamp;
return this;
}
/**
* Builds a new {@link ImmutableCloudEvent ImmutableCloudEvent}.
* @return An immutable instance of CloudEvent
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableCloudEvent build() {
return new ImmutableCloudEvent(name, metadata, v3Metadata, type, actor, actee, timestamp);
}
}
/**
* Immutable implementation of {@link CloudEvent.Participant}.
*
* Use the builder to create immutable instances:
* {@code ImmutableCloudEvent.ImmutableParticipant.builder()}.
*/
@Generated(from = "CloudEvent.Participant", generator = "Immutables")
public static final class ImmutableParticipant implements CloudEvent.Participant {
private final @Nullable UUID guid;
private final @Nullable String name;
private final @Nullable String type;
private ImmutableParticipant(
@Nullable UUID guid,
@Nullable String name,
@Nullable String type) {
this.guid = guid;
this.name = name;
this.type = type;
}
/**
* @return The value of the {@code guid} attribute
*/
@JsonProperty("guid")
@Override
public @Nullable UUID getGuid() {
return guid;
}
/**
* @return The value of the {@code name} attribute
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* @return The value of the {@code type} attribute
*/
@JsonProperty("type")
@Override
public @Nullable String getType() {
return type;
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent.Participant#getGuid() guid} 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 guid (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent.ImmutableParticipant withGuid(@Nullable UUID value) {
if (this.guid == value) return this;
return new ImmutableCloudEvent.ImmutableParticipant(value, this.name, this.type);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent.Participant#getName() name} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for name (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent.ImmutableParticipant withName(@Nullable String value) {
if (Objects.equals(this.name, value)) return this;
return new ImmutableCloudEvent.ImmutableParticipant(this.guid, value, this.type);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudEvent.Participant#getType() type} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for type (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudEvent.ImmutableParticipant withType(@Nullable String value) {
if (Objects.equals(this.type, value)) return this;
return new ImmutableCloudEvent.ImmutableParticipant(this.guid, this.name, value);
}
/**
* This instance is equal to all instances of {@code ImmutableParticipant} 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 ImmutableCloudEvent.ImmutableParticipant
&& equalTo((ImmutableCloudEvent.ImmutableParticipant) another);
}
private boolean equalTo(ImmutableCloudEvent.ImmutableParticipant another) {
return Objects.equals(guid, another.guid)
&& Objects.equals(name, another.name)
&& Objects.equals(type, another.type);
}
/**
* Computes a hash code from attributes: {@code guid}, {@code name}, {@code type}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(guid);
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(type);
return h;
}
/**
* Prints the immutable value {@code Participant} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "Participant{"
+ "guid=" + guid
+ ", name=" + name
+ ", type=" + type
+ "}";
}
/**
* 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 = "CloudEvent.Participant", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json implements CloudEvent.Participant {
UUID guid;
String name;
String type;
@JsonProperty("guid")
public void setGuid(@Nullable UUID guid) {
this.guid = guid;
}
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("type")
public void setType(@Nullable String type) {
this.type = type;
}
@Override
public UUID getGuid() { throw new UnsupportedOperationException(); }
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public String getType() { 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 ImmutableCloudEvent.ImmutableParticipant fromJson(Json json) {
ImmutableCloudEvent.ImmutableParticipant.Builder builder = ImmutableCloudEvent.ImmutableParticipant.builder();
if (json.guid != null) {
builder.guid(json.guid);
}
if (json.name != null) {
builder.name(json.name);
}
if (json.type != null) {
builder.type(json.type);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link CloudEvent.Participant} 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 Participant instance
*/
public static ImmutableCloudEvent.ImmutableParticipant copyOf(CloudEvent.Participant instance) {
if (instance instanceof ImmutableCloudEvent.ImmutableParticipant) {
return (ImmutableCloudEvent.ImmutableParticipant) instance;
}
return ImmutableCloudEvent.ImmutableParticipant.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableCloudEvent.ImmutableParticipant ImmutableParticipant}.
*
* ImmutableCloudEvent.ImmutableParticipant.builder()
* .guid(UUID | null) // nullable {@link CloudEvent.Participant#getGuid() guid}
* .name(String | null) // nullable {@link CloudEvent.Participant#getName() name}
* .type(String | null) // nullable {@link CloudEvent.Participant#getType() type}
* .build();
*
* @return A new ImmutableParticipant builder
*/
public static ImmutableCloudEvent.ImmutableParticipant.Builder builder() {
return new ImmutableCloudEvent.ImmutableParticipant.Builder();
}
/**
* Builds instances of type {@link ImmutableCloudEvent.ImmutableParticipant ImmutableParticipant}.
* 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 = "CloudEvent.Participant", generator = "Immutables")
public static final class Builder {
private UUID guid;
private String name;
private String type;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code Participant} 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(CloudEvent.Participant instance) {
Objects.requireNonNull(instance, "instance");
@Nullable UUID guidValue = instance.getGuid();
if (guidValue != null) {
guid(guidValue);
}
@Nullable String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
@Nullable String typeValue = instance.getType();
if (typeValue != null) {
type(typeValue);
}
return this;
}
/**
* Initializes the value for the {@link CloudEvent.Participant#getGuid() guid} attribute.
* @param guid The value for guid (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("guid")
public final Builder guid(@Nullable UUID guid) {
this.guid = guid;
return this;
}
/**
* Initializes the value for the {@link CloudEvent.Participant#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 CloudEvent.Participant#getType() type} attribute.
* @param type The value for type (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("type")
public final Builder type(@Nullable String type) {
this.type = type;
return this;
}
/**
* Builds a new {@link ImmutableCloudEvent.ImmutableParticipant ImmutableParticipant}.
* @return An immutable instance of Participant
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableCloudEvent.ImmutableParticipant build() {
return new ImmutableCloudEvent.ImmutableParticipant(guid, name, type);
}
}
}
}