Class ContextConfiguration

    • Constructor Detail

      • ContextConfiguration

        public ContextConfiguration​(LogContext context)
        Creates a new context configuration.
    • Method Detail

      • getContext

        public LogContext getContext()
        Returns the context for this configuration.
        Returns:
        the context for this configuration
      • hasLogger

        public boolean hasLogger​(String name)
        Checks if the logger exists in this context.
        Parameters:
        name - the logger name
        Returns:
        true if the logger exists in this context, otherwise false
      • getLogger

        public Logger getLogger​(String name)
        Gets the logger if it exists.
        Parameters:
        name - the name of the logger
        Returns:
        the logger or null if the logger does not exist
      • getLoggers

        public Set<String> getLoggers()
        Returns an unmodifiable set of the configured logger names
        Returns:
        an unmodified set of the logger names
      • addErrorManager

        public ConfigurationResource<ErrorManager> addErrorManager​(String name,
                                                                   Supplier<ErrorManager> errorManager)
        Adds an error manager to the context configuration.
        Parameters:
        name - the name for the error manager
        errorManager - the error manager to add
        Returns:
        the previous error manager associated with the name or null if one did not exist
      • removeErrorManager

        public ConfigurationResource<ErrorManager> removeErrorManager​(String name)
        Removes the error manager from the context configuration.
        Parameters:
        name - the name of the error manager
        Returns:
        the error manager removed or null if the error manager did not exist
      • hasErrorManager

        public boolean hasErrorManager​(String name)
        Checks if the error manager exists with the name provided.
        Parameters:
        name - the name for the error manager
        Returns:
        true if the error manager exists in this context, otherwise false
      • getErrorManager

        public ErrorManager getErrorManager​(String name)
        Gets the error manager if it exists.
        Parameters:
        name - the name of the error manager
        Returns:
        the error manager or null if the error manager does not exist
      • getErrorManagers

        public Map<String,​ConfigurationResource<ErrorManager>> getErrorManagers()
        Returns an unmodifiable map of the error managers and the suppliers used to create them.
        Returns:
        an unmodified map of the error managers
      • addHandler

        public ConfigurationResource<Handler> addHandler​(String name,
                                                         Supplier<Handler> handler)
        Adds a handler to the context configuration.
        Parameters:
        name - the name for the handler
        handler - the handler to add
        Returns:
        the previous handler associated with the name or null if one did not exist
      • removeHandler

        public ConfigurationResource<Handler> removeHandler​(String name)
        Removes the handler from the context configuration.
        Parameters:
        name - the name of the handler
        Returns:
        the handler removed or null if the handler did not exist
      • hasHandler

        public boolean hasHandler​(String name)
        Checks if the handler exists with the name provided.
        Parameters:
        name - the name for the handler
        Returns:
        true if the handler exists in this context, otherwise false
      • getHandler

        public Handler getHandler​(String name)
        Gets the handler if it exists.
        Parameters:
        name - the name of the handler
        Returns:
        the handler or null if the handler does not exist
      • getHandlers

        public Map<String,​ConfigurationResource<Handler>> getHandlers()
        Returns an unmodifiable map of the handlers and the suppliers used to create them.
        Returns:
        an unmodified map of the handlers
      • addFormatter

        public ConfigurationResource<Formatter> addFormatter​(String name,
                                                             Supplier<Formatter> formatter)
        Adds a formatter to the context configuration.
        Parameters:
        name - the name for the formatter
        formatter - the formatter to add
        Returns:
        the previous formatter associated with the name or null if one did not exist
      • removeFormatter

        public ConfigurationResource<Formatter> removeFormatter​(String name)
        Removes the formatter from the context configuration.
        Parameters:
        name - the name of the formatter
        Returns:
        the formatter removed or null if the formatter did not exist
      • hasFormatter

        public boolean hasFormatter​(String name)
        Checks if the formatter exists with the name provided.
        Parameters:
        name - the name for the formatter
        Returns:
        true if the formatter exists in this context, otherwise false
      • getFormatter

        public Formatter getFormatter​(String name)
        Gets the formatter if it exists.
        Parameters:
        name - the name of the formatter
        Returns:
        the formatter or null if the formatter does not exist
      • getFormatters

        public Map<String,​Supplier<Formatter>> getFormatters()
        Returns an unmodifiable map of the formatters and the suppliers used to create them.
        Returns:
        an unmodified map of the formatters
      • addFilter

        public ConfigurationResource<Filter> addFilter​(String name,
                                                       Supplier<Filter> filter)
        Adds a filter to the context configuration.
        Parameters:
        name - the name for the filter
        filter - the filter to add
        Returns:
        the previous filter associated with the name or null if one did not exist
      • removeFilter

        public ConfigurationResource<Filter> removeFilter​(String name)
        Removes the filter from the context configuration.
        Parameters:
        name - the name of the filter
        Returns:
        the filter removed or null if the filter did not exist
      • hasFilter

        public boolean hasFilter​(String name)
        Checks if the filter exists with the name provided.
        Parameters:
        name - the name for the filter
        Returns:
        true if the filter exists in this context, otherwise false
      • getFilter

        public Filter getFilter​(String name)
        Gets the filter if it exists.
        Parameters:
        name - the name of the filter
        Returns:
        the filer or null if the filter does not exist
      • getFilters

        public Map<String,​ConfigurationResource<Filter>> getFilters()
        Returns an unmodifiable map of the filters and the suppliers used to create them.
        Returns:
        an unmodified map of the filters
      • addObject

        public ConfigurationResource<Object> addObject​(String name,
                                                       Supplier<Object> object)
        Adds an object that can be used as a configuration property for another configuration type. This is used for cases when an object cannot simply be converted from a string.
        Parameters:
        name - the name for the configuration object
        object - the configuration object to add
        Returns:
        the previous configuration object associated with the name or null if one did not exist
      • removeObject

        public ConfigurationResource<Object> removeObject​(String name)
        Removes the configuration object from the context configuration.
        Parameters:
        name - the name of the configuration object
        Returns:
        the configuration object removed or null if the configuration object did not exist
      • hasObject

        public boolean hasObject​(String name)
        Checks if the configuration object exists with the name provided.
        Parameters:
        name - the name for the configuration object
        Returns:
        true if the configuration object exists in this context, otherwise false
      • getObject

        public Object getObject​(String name)
        Gets the configuration object if it exists.
        Parameters:
        name - the name of the configuration object
        Returns:
        the configuration object or null if the configuration object does not exist
      • getObjects

        public Map<String,​ConfigurationResource<Object>> getObjects()
        Returns an unmodifiable map of the configuration objects and the suppliers used to create them.
        Returns:
        an unmodified map of the configuration objects