Class InvocationHandler.Builder

    • Method Detail

      • 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 a RuntimeException 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, otherwise defaultErrorMessage(String) is returned.
        Parameters:
        exceptionClass - exception to whitelist
        Returns:
        updated builder instance