Class JsonRpcHandlers.BuilderBase<BUILDER extends JsonRpcHandlers.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends JsonRpcHandlers>

java.lang.Object
io.helidon.webserver.jsonrpc.JsonRpcHandlers.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
JsonRpcHandlers.Builder
Enclosing interface:
JsonRpcHandlers

public abstract static class JsonRpcHandlers.BuilderBase<BUILDER extends JsonRpcHandlers.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends JsonRpcHandlers> extends Object implements Prototype.Builder<BUILDER,PROTOTYPE>
Fluent API builder base for JsonRpcHandlers.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(JsonRpcHandlers prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(JsonRpcHandlers.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • handlersMap

      public BUILDER handlersMap(Map<String,? extends JsonRpcHandler> handlersMap)
      Return a map of method names to handlers. This method replaces all values with the new ones.
      Parameters:
      handlersMap - a map of method names to handlers
      Returns:
      updated builder instance
      See Also:
    • addHandlersMap

      public BUILDER addHandlersMap(Map<String,? extends JsonRpcHandler> handlersMap)
      Return a map of method names to handlers. This method keeps existing values, then puts all new values into the map.
      Parameters:
      handlersMap - a map of method names to handlers
      Returns:
      updated builder instance
      See Also:
    • method

      public BUILDER method(String key, JsonRpcHandler method)
      Return a map of method names to handlers. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      method - new value for the key
      Returns:
      updated builder instance
      See Also:
    • clearErrorHandler

      public BUILDER clearErrorHandler()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • errorHandler

      public BUILDER errorHandler(JsonRpcErrorHandler errorHandler)
      Get access to the error handler, if registered.
      Parameters:
      errorHandler - the error handler or null
      Returns:
      updated builder instance
      See Also:
    • exceptionMap

      public BUILDER exceptionMap(Map<Class<? extends Throwable>,? extends JsonRpcExceptionHandler> exceptionMap)
      Return a map of throwable to exception handlers. This method replaces all values with the new ones.
      Parameters:
      exceptionMap - a map of method names to handlers
      Returns:
      updated builder instance
      See Also:
    • addExceptionMap

      public BUILDER addExceptionMap(Map<Class<? extends Throwable>,? extends JsonRpcExceptionHandler> exceptionMap)
      Return a map of throwable to exception handlers. This method keeps existing values, then puts all new values into the map.
      Parameters:
      exceptionMap - a map of method names to handlers
      Returns:
      updated builder instance
      See Also:
    • exception

      public BUILDER exception(Class<? extends Throwable> key, JsonRpcExceptionHandler exception)
      Return a map of throwable to exception handlers. This method adds a new value to the map, or replaces it if the key already exists.
      Parameters:
      key - key to add or replace
      exception - new value for the key
      Returns:
      updated builder instance
      See Also:
    • handlersMap

      public Map<String,JsonRpcHandler> handlersMap()
      Return a map of method names to handlers.
      Returns:
      the handlers map
    • errorHandler

      public Optional<JsonRpcErrorHandler> errorHandler()
      Get access to the error handler, if registered.
      Returns:
      the error handler
    • exceptionMap

      public Map<Class<? extends Throwable>,JsonRpcExceptionHandler> exceptionMap()
      Return a map of throwable to exception handlers.
      Returns:
      the exception map
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.