Class ApiOptionalResponse.BuilderBase<B extends ApiOptionalResponse.BuilderBase<B,T,X,R>,T extends ApiOptionalResponse<R>,X,R>
- java.lang.Object
-
- io.helidon.integrations.common.rest.ApiResponse.Builder<B,T>
-
- io.helidon.integrations.common.rest.ApiOptionalResponse.BuilderBase<B,T,X,R>
-
- Type Parameters:
B
- type of the builder (extending the base builder)T
- type of the subclass ofApiOptionalResponse
X
- type of the entity (JsonObject, byte[])R
- type of the (optional) response object
- All Implemented Interfaces:
Builder<T>
,ResponseBuilder<B,T,X>
,Supplier<T>
- Direct Known Subclasses:
ApiOptionalResponse.Builder
,VaultOptionalResponse.BuilderBase
- Enclosing class:
- ApiOptionalResponse<R>
public abstract static class ApiOptionalResponse.BuilderBase<B extends ApiOptionalResponse.BuilderBase<B,T,X,R>,T extends ApiOptionalResponse<R>,X,R> extends ApiResponse.Builder<B,T> implements ResponseBuilder<B,T,X>
Fluent API builder base for subclasses ofApiOptionalResponse
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BuilderBase()
New builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Optional<X>
entity()
Entity as received from network.B
entity(X entity)
Configure the entity.protected Function<X,R>
entityProcessor()
The configured entity processor.B
entityProcessor(Function<X,R> processor)
A function to convert the entity to target object.-
Methods inherited from class io.helidon.integrations.common.rest.ApiResponse.Builder
headers, headers, me, requestId, requestId, status, status
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.integrations.common.rest.ResponseBuilder
headers, requestId, status
-
-
-
-
Method Detail
-
entity
public B entity(X entity)
Configure the entity. Invoked byRestApi
.- Specified by:
entity
in interfaceResponseBuilder<B extends ApiOptionalResponse.BuilderBase<B,T,X,R>,T extends ApiOptionalResponse<R>,X>
- Parameters:
entity
- entity to use (only called if present)- Returns:
- updated builder
-
entityProcessor
public B entityProcessor(Function<X,R> processor)
A function to convert the entity to target object. The processor is only invoked in case an entity is present.- Parameters:
processor
- create response object from entity- Returns:
- updated builder
-
entity
protected Optional<X> entity()
Entity as received from network.- Returns:
- entity if present, empty otherwise
-
-