Class ApiOptionalResponse<R>
java.lang.Object
io.helidon.integrations.common.rest.ApiJsonParser
io.helidon.integrations.common.rest.ApiResponse
io.helidon.integrations.common.rest.ApiOptionalResponse<R>
- Type Parameters:
R- type of the (optional) response object created from entity
- Direct Known Subclasses:
VaultOptionalResponse
A response for requests that may or may not return an entity, such as
GET requests that may have a
404 response code.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFluent API builder forApiOptionalResponse.static classApiOptionalResponse.BuilderBase<B extends ApiOptionalResponse.BuilderBase<B,T, X, R>, T extends ApiOptionalResponse<R>, X, R> Fluent API builder base for subclasses ofApiOptionalResponse. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedApiOptionalResponse(ApiOptionalResponse.BuilderBase<?, ?, ?, ?> builder, Optional<R> entity) -
Method Summary
Modifier and TypeMethodDescriptionstatic <X,R> ApiOptionalResponse.Builder <X, R> A builder to create an optional response.entity()Get the entity if it is present.<U> ApiOptionalResponse<U> Map the (possible) response entity to a different type.Methods inherited from class io.helidon.integrations.common.rest.ApiResponse
headers, requestId, statusMethods inherited from class io.helidon.integrations.common.rest.ApiJsonParser
isPresent, isPresent, stringValue, stringValue, toBoolean, toBoolean, toBytesBase64, toBytesBase64, toDouble, toDouble, toInstant, toInstant, toInt, toInt, toList, toList, toLong, toLong, toMap, toMap, toObject, toObject, toString, toString
-
Constructor Details
-
ApiOptionalResponse
-
-
Method Details
-
apiResponseBuilder
A builder to create an optional response. Method name is notbuilderto allow subclasses to define their own builder methods.- Type Parameters:
X- expected entity (such asJsonObjectR- type of object used to represent the entity- Returns:
- a new builder
-
entity
Get the entity if it is present.- Returns:
- optional with the entity
-
map
Map the (possible) response entity to a different type.- Type Parameters:
U- new type- Parameters:
mapper- mapper function- Returns:
- new optional response with the mapped entity
-