java.lang.Object
io.hypersistence.optimizer.core.config.Config
Direct Known Subclasses:
HibernateConfig, JpaConfig

public abstract class Config extends Object
The Config class defines the current configuration.

All the project-specific dependencies can be customized, like the EventHandler, EventFilter, EventDecorator, EventSender or the ExceptionHandler.

Since:
1.0.0
Author:
Vlad Mihalcea
  • Constructor Details

    • Config

      public Config()
      Initializing constructor.
  • Method Details

    • getEventHandler

      public EventHandler getEventHandler()
      Get the current EventHandler.
      Returns:
      current EventHandler
    • setEventHandler

      public Config setEventHandler(EventHandler eventHandler)
      Set the current EventHandler.
      Parameters:
      eventHandler - current EventHandler
      Returns:
      this Config
    • addEventHandler

      public Config addEventHandler(EventHandler eventHandler)
      Add the provided EventHandler.
      Parameters:
      eventHandler - provided EventHandler
      Returns:
      this Config
    • getEventFilter

      public EventFilter getEventFilter()
      Get the current EventFilter.
      Returns:
      current EventFilter
    • setEventFilter

      public Config setEventFilter(EventFilter eventFilter)
      Set the current EventFilter.
      Parameters:
      eventFilter - current EventFilter
      Returns:
      this Config
    • getEventDecorator

      public EventDecorator getEventDecorator()
      Get the current EventDecorator.
      Returns:
      current EventDecorator
    • setEventDecorator

      public Config setEventDecorator(EventDecorator eventDecorator)
      Set the current EventDecorator.
      Parameters:
      eventDecorator - current EventDecorator
      Returns:
      this Config
    • getEventSender

      public EventSender getEventSender()
      Get the current EventSender.
      Returns:
      current EventSender
    • setEventSender

      public Config setEventSender(EventSender eventSender)
      Set the current EventSender.
      Parameters:
      eventSender - current EventSender
      Returns:
      this Config
    • getExceptionHandler

      public ExceptionHandler getExceptionHandler()
      Get the current ExceptionHandler.
      Returns:
      current ExceptionHandler
    • setExceptionHandler

      public Config setExceptionHandler(ExceptionHandler exceptionHandler)
      Set the current ExceptionHandler.
      Parameters:
      exceptionHandler - current ExceptionHandler
      Returns:
      this Config
    • isMappingScannerEnabled

      public boolean isMappingScannerEnabled()
      Check if the mapping scanner enabled.
      Returns:
      the mapping scanner is enabled
    • setMappingScannerEnabled

      public Config setMappingScannerEnabled(boolean mappingScannerEnabled)
      Enable or disable the mapping scanner.
      Parameters:
      mappingScannerEnabled - if the mapping scanner is to be enabled
      Returns:
      this Config
    • isConfigurationScannerEnabled

      public boolean isConfigurationScannerEnabled()
      Check if the configuration scanner enabled.
      Returns:
      the configuration scanner is enabled
    • setConfigurationScannerEnabled

      public Config setConfigurationScannerEnabled(boolean configurationScannerEnabled)
      Enable or disable the configuration scanner.
      Parameters:
      configurationScannerEnabled - if the configuration scanner is to be enabled
      Returns:
      this Config
    • setMetadataScannersEnabled

      public Config setMetadataScannersEnabled(boolean metadataScannerEnabled)
      Enable or disable the metadata scanners (mapping and configuration). This is equivalent to calling setMappingScannerEnabled(boolean) and setConfigurationScannerEnabled(boolean) with the current configurationScannerEnabled argument.
      Parameters:
      metadataScannerEnabled - if the mapping and configuration scanners are to be enabled
      Returns:
      this Config
    • isRuntimeScannerEnabled

      public boolean isRuntimeScannerEnabled()
      Check if the runtime scanner enabled.
      Returns:
      the runtime scanner is enabled
    • setRuntimeScannerEnabled

      public Config setRuntimeScannerEnabled(boolean runtimeScannerEnabled)
      Enable or disable the runtime scanner.
      Parameters:
      runtimeScannerEnabled - if the runtime scanner is to be enabled
      Returns:
      this Config
    • isBannerPrintingEnabled

      public boolean isBannerPrintingEnabled()
      Check if the banner printing is enabled.
      Returns:
      the banner printing is enabled.
    • setBannerPrintingEnabled

      public Config setBannerPrintingEnabled(boolean bannerPrintingEnabled)
      Enable or disable the banner printing.
      Parameters:
      bannerPrintingEnabled - if the banner printing is to be enabled
      Returns:
      this Config
    • getEventHandlers

      public List<EventHandler> getEventHandlers()
      Get the EventHandler list.
      Returns:
      the EventHandler list
    • getProperties

      public Map<String,Object> getProperties()
      Get runtime properties that can override default settings.
      Returns:
      runtime properties
    • setProperties

      public Config setProperties(Map<String,Object> properties)
      Set runtime properties that can override default settings.
      Parameters:
      properties - runtime properties
      Returns:
      this Config
    • getJmx

      public Config.Jmx getJmx()
      Get the JMX configuration.
      Returns:
      the JMX configuration
    • setJmx

      public Config setJmx(Config.Jmx jmxConfig)
      Set the JMX configuration.
      Parameters:
      jmxConfig - JMX configuration
      Returns:
      this Config
    • getEventPersistence

      public Config.EventPersistence getEventPersistence()
      Get the event persistence configuration.
      Returns:
      the event persistence configuration
    • setEventPersistence

      public Config setEventPersistence(Config.EventPersistence eventPersistence)
      Set the event persistence configuration. Providing a non-null, enabled Config.EventPersistence activates the feature that stores the detected events into a database table over time.
      Parameters:
      eventPersistence - the event persistence configuration
      Returns:
      this Config
    • mergeProperties

      public void mergeProperties(Map<String,Object> factoryProperties)
      Merge the JPA EntityManagerFactory or the Hibernate SessionFactory properties with the Hypersistence ones, and call the PropertiesSetter objects.
      Parameters:
      factoryProperties - factory properties