Package org.eclipse.ditto.things.api
Class ThingSnapshotTaken.Builder
java.lang.Object
org.eclipse.ditto.things.api.ThingSnapshotTaken.Builder
- Enclosing class:
- ThingSnapshotTaken
A mutable builder with a fluent API for creating instances of
ThingSnapshotTaken.
By default the builder sets the timestamp of the event to Instant.now() and empty DittoHeaders.
Both properties can be overwritten by calling the appropriate setter methods.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Constructs a newThingSnapshotTakeninstance.dittoHeaders(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Sets the specified DittoHeaders.metadata(org.eclipse.ditto.base.model.entity.metadata.Metadata metadata) Sets the specified metadata.policyId(org.eclipse.ditto.policies.model.PolicyId policyId) Sets the specified policy ID.Sets the timestamp when the snapshot was taken.
-
Method Details
-
policyId
public ThingSnapshotTaken.Builder policyId(@Nullable org.eclipse.ditto.policies.model.PolicyId policyId) Sets the specified policy ID.- Parameters:
policyId- the policy ID to be set ornullif the event has none (default).- Returns:
- this builder instance.
-
timestamp
Sets the timestamp when the snapshot was taken. By default the timestamp is set toInstant.now().- Parameters:
timestamp- the timestamp to be set ornullif the event does not have a timestamp at all.- Returns:
- this builder instance.
-
metadata
public ThingSnapshotTaken.Builder metadata(@Nullable org.eclipse.ditto.base.model.entity.metadata.Metadata metadata) Sets the specified metadata.- Parameters:
metadata- the metadata to be set ornullif the event has none (default).- Returns:
- this builder instance.
-
dittoHeaders
public ThingSnapshotTaken.Builder dittoHeaders(org.eclipse.ditto.base.model.headers.DittoHeaders dittoHeaders) Sets the specified DittoHeaders. By default empty headers are set.- Parameters:
dittoHeaders- the headers to be set.- Returns:
- this builder instance.
- Throws:
NullPointerException- ifdittoHeadersisnull.
-
build
Constructs a newThingSnapshotTakeninstance.- Returns:
- the ThingSnapshotTaken instance.
-