public class OutputBuilder extends Object
Constructor and Description |
---|
OutputBuilder() |
Modifier and Type | Method and Description |
---|---|
OutputBuilder |
add(String name,
boolean value)
Adds an output attribute
If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
|
OutputBuilder |
add(String name,
double value)
Adds an output attribute
If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
|
OutputBuilder |
add(String name,
int value)
Adds an output attribute
If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
|
OutputBuilder |
add(String name,
long value)
Adds an output attribute
If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
|
OutputBuilder |
add(String name,
String value)
Adds an output attribute
If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
|
void |
addAttachment(Attachment attachment)
Adds an attachment to the output
|
void |
addAttachments(List<Attachment> attachments)
Adds attachments to the output
|
void |
addMeasure(String measureName,
long durationMillis)
Adds a performance measurement
|
void |
addMeasure(String measureName,
long aDurationMillis,
Map<String,Object> data)
Adds a performance measurement with custom data
|
OutputBuilder |
appendError(String technicalError)
Appends a technical error message.
|
Output<javax.json.JsonObject> |
build()
Builds the output instance
|
javax.json.JsonObjectBuilder |
getPayloadBuilder() |
String |
getPayloadJson() |
OutputBuilder |
setBusinessError(String businessError)
Reports a business error.
|
OutputBuilder |
setError(Error error) |
OutputBuilder |
setError(String technicalError)
Reports a technical error.
|
OutputBuilder |
setError(String errorMessage,
Throwable e)
Reports a technical error and appends the exception causing this error
as attachment
|
void |
setLastMeasureAdditionalData(Map<String,Object> data) |
void |
setPayloadBuilder(javax.json.JsonObjectBuilder payloadBuilder) |
void |
setPayloadJson(String payloadJson) |
void |
startMeasure(String id)
Starts a performance measurement.
|
void |
startMeasure(String id,
long begin)
Starts a performance measurement
|
void |
stopMeasure()
Stops the current performance measurement and adds it to the output
|
void |
stopMeasure(Map<String,Object> data)
Stops the current performance measurement and adds it to the output.
|
void |
stopMeasureForAdditionalData() |
public javax.json.JsonObjectBuilder getPayloadBuilder()
public void setPayloadBuilder(javax.json.JsonObjectBuilder payloadBuilder)
public OutputBuilder add(String name, boolean value)
name
- the name of the output attributevalue
- the value of the output attributepublic OutputBuilder add(String name, double value)
name
- the name of the output attributevalue
- the value of the output attributepublic OutputBuilder add(String name, int value)
name
- the name of the output attributevalue
- the value of the output attributepublic OutputBuilder add(String name, long value)
name
- the name of the output attributevalue
- the value of the output attributepublic OutputBuilder add(String name, String value)
name
- the name of the output attributevalue
- the value of the output attributepublic OutputBuilder setError(String technicalError)
technicalError
- the error message of the technical errorpublic OutputBuilder appendError(String technicalError)
technicalError
- the error message of the technical errorpublic OutputBuilder setError(String errorMessage, Throwable e)
errorMessage
- the error message of the technical errore
- the exception that caused the technical errorpublic OutputBuilder setBusinessError(String businessError)
businessError
- the error message of the business errorpublic OutputBuilder setError(Error error)
public String getPayloadJson()
public void setPayloadJson(String payloadJson)
payloadJson
- the payload of this output.public void addAttachments(List<Attachment> attachments)
attachments
- the list of attachments to be added to the outputpublic void addAttachment(Attachment attachment)
attachment
- the attachment to be added to the outputpublic void startMeasure(String id)
id
- a unique identifier of the measurementpublic void startMeasure(String id, long begin)
id
- a unique identifier of the measurementbegin
- the start time of the measurementpublic void addMeasure(String measureName, long durationMillis)
measureName
- a unique identifier of the measurementdurationMillis
- the duration of the measurement in mspublic void addMeasure(String measureName, long aDurationMillis, Map<String,Object> data)
measureName
- a unique identifier of the measurementaDurationMillis
- the duration of the measurement in msdata
- the custom data of the measurementpublic void stopMeasure()
public void stopMeasure(Map<String,Object> data)
data
- custom data to be added to the measurementpublic void stopMeasureForAdditionalData()
public Output<javax.json.JsonObject> build()
Copyright © 2020. All rights reserved.