- java.lang.Object
-
- io.helidon.graphql.server.InvocationHandler.Builder
-
- All Implemented Interfaces:
Builder<InvocationHandler>
,Supplier<InvocationHandler>
- Enclosing interface:
- InvocationHandler
public static class InvocationHandler.Builder extends Object implements Builder<InvocationHandler>
Fluent API builder to configure the invocation handler.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InvocationHandler.Builder
addBlacklistedException(String exceptionClass)
Add an exception to the blacklist.InvocationHandler.Builder
addWhitelistedException(String exceptionClass)
Add an exception to the whitelist.InvocationHandler
build()
Build the instance from this builder.InvocationHandler.Builder
config(Config config)
Update builder from configuration.InvocationHandler.Builder
defaultErrorMessage(String defaultErrorMessage)
Default error message to return when an internal server error occurs.InvocationHandler.Builder
exceptionBlacklist(String[] classNames)
Blacklisted error classes that will not return error message back to caller.InvocationHandler.Builder
exceptionWhitelist(String[] classNames)
Whitelisted error classes that will return error message back to caller.InvocationHandler.Builder
schema(graphql.schema.GraphQLSchema schema)
Configure the GraphQL schema to be used.
-
-
-
Method Detail
-
build
public InvocationHandler build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<InvocationHandler>
- Returns:
- instance of the built type
-
config
public InvocationHandler.Builder config(Config config)
Update builder from configuration. Configuration options:Optional configuration parameters key default value description default-error-message "Server Error" Error message used for internal errors that are not whitelisted. exception-white-list Array of exceptions classes. If an Error
or aRuntimeException
of this type is caught, its message will be propagated to the caller.exception-black-list Array of exception classes. If a checked Exception
is called, its message is propagated to the caller, unless it is in the blacklist.- Parameters:
config
- configuration to use- Returns:
- updated builder instance
-
schema
public InvocationHandler.Builder schema(graphql.schema.GraphQLSchema schema)
Configure the GraphQL schema to be used.- Parameters:
schema
- schema to handle by this support- Returns:
- updated builder instance
-
defaultErrorMessage
public InvocationHandler.Builder defaultErrorMessage(String defaultErrorMessage)
Default error message to return when an internal server error occurs.- Parameters:
defaultErrorMessage
- default error message- Returns:
- updated builder instance
-
exceptionBlacklist
public InvocationHandler.Builder exceptionBlacklist(String[] classNames)
Blacklisted error classes that will not return error message back to caller.- Parameters:
classNames
- names of classes to deny for checked exceptions- Returns:
- updated builder instance
-
addBlacklistedException
public InvocationHandler.Builder addBlacklistedException(String exceptionClass)
Add an exception to the blacklist. If a blacklisted exception is thrown,defaultErrorMessage(String)
is returned instead.- Parameters:
exceptionClass
- exception to blacklist- Returns:
- updated builder instance
-
exceptionWhitelist
public InvocationHandler.Builder exceptionWhitelist(String[] classNames)
Whitelisted error classes that will return error message back to caller.- Parameters:
classNames
- names of classes to allow for runtime exceptions and errors- Returns:
- updated builder instance
-
addWhitelistedException
public InvocationHandler.Builder addWhitelistedException(String exceptionClass)
Add an exception to the whitelist. If a whitelisted exception is thrown, its message is returned, otherwisedefaultErrorMessage(String)
is returned.- Parameters:
exceptionClass
- exception to whitelist- Returns:
- updated builder instance
-
-