Class ResponseEnvelope.Builder<T>
java.lang.Object
com.helixframework.api.contract.envelope.ResponseEnvelope.Builder<T>
- Type Parameters:
T- the type of data in the envelope
- Enclosing class:
- ResponseEnvelope<T>
Represents a builder for constructing ResponseEnvelope objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a new link to the ResponseEnvelope builder.build()Constructs a ResponseEnvelope object based on the builder settings.Sets the data for the ResponseEnvelope builder.Sets the links for the ResponseEnvelope builder.setMetadata(String key, Object value) Sets a metadata key-value pair for the ResponseEnvelope builder.setMetadata(Map<String, Object> metadata) Sets the metadata for the ResponseEnvelope builder.setRequestId(String requestId) Sets the request ID for the ResponseEnvelope builder.setStatus(ResponseStatus status) Sets the status for the ResponseEnvelope builder.setTimestamp(ZonedDateTime timestamp) Sets the timestamp for the ResponseEnvelope builder.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setRequestId
Sets the request ID for the ResponseEnvelope builder.- Parameters:
requestId- the unique identifier for the request- Returns:
- the builder object to allow for method chaining
-
setStatus
Sets the status for the ResponseEnvelope builder.- Parameters:
status- the response status to be set- Returns:
- the builder object to allow for method chaining
-
setTimestamp
Sets the timestamp for the ResponseEnvelope builder.- Parameters:
timestamp- the ZonedDateTime object representing the timestamp to be set- Returns:
- the builder object to allow for method chaining
-
setMetadata
Sets the metadata for the ResponseEnvelope builder.- Parameters:
metadata- a Map containing key-value pairs of metadata- Returns:
- the builder object to allow for method chaining
-
setMetadata
Sets a metadata key-value pair for the ResponseEnvelope builder.- Parameters:
key- the key for the metadata entryvalue- the value for the metadata entry- Returns:
- the builder object to allow for method chaining
-
setData
Sets the data for the ResponseEnvelope builder.- Parameters:
data- the data object to be set in the ResponseEnvelope- Returns:
- the builder object to allow for method chaining
-
setLinks
Sets the links for the ResponseEnvelope builder.- Parameters:
links- the links to be set- Returns:
- the builder object to allow for method chaining
-
addLink
Adds a new link to the ResponseEnvelope builder.- Parameters:
name- the name of the link to be addedlink- the HalLink object representing the link to be added- Returns:
- the builder object to allow for method chaining
-
build
Constructs a ResponseEnvelope object based on the builder settings. If the request ID or timestamp is not set, default values will be used.- Returns:
- a ResponseEnvelope object constructed with the builder settings
-