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 of ApiOptionalResponse
X - type of the entity (JsonObject, byte[])
R - type of the (optional) response object
All Implemented Interfaces:
Builder<B,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 of ApiOptionalResponse.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      New builder.
  • Method Details

    • entity

      public B entity(X entity)
      Configure the entity. Invoked by RestApi.
      Specified by:
      entity in interface ResponseBuilder<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
    • entityProcessor

      protected Function<X,R> entityProcessor()
      The configured entity processor.
      Returns:
      processor