Class Config
java.lang.Object
io.hypersistence.optimizer.core.config.Config
- Direct Known Subclasses:
HibernateConfig,JpaConfig
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTheConfig.EventPersistenceconfiguration activates and tunes the feature that stores the detected events into a database table over time.static classJMX configuration.static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEventHandler(EventHandler eventHandler) Add the providedEventHandler.Get the currentEventDecorator.Get the currentEventFilter.Get the currentEventHandler.Get theEventHandlerlist.Get the event persistence configuration.Get the currentEventSender.Get the currentExceptionHandler.getJmx()Get the JMX configuration.Get runtime properties that can override default settings.booleanCheck if the banner printing is enabled.booleanCheck if the configuration scanner enabled.booleanCheck if the mapping scanner enabled.booleanCheck if the runtime scanner enabled.voidmergeProperties(Map<String, Object> factoryProperties) Merge the JPAEntityManagerFactoryor the HibernateSessionFactoryproperties with the Hypersistence ones, and call thePropertiesSetterobjects.setBannerPrintingEnabled(boolean bannerPrintingEnabled) Enable or disable the banner printing.setConfigurationScannerEnabled(boolean configurationScannerEnabled) Enable or disable the configuration scanner.setEventDecorator(EventDecorator eventDecorator) Set the currentEventDecorator.setEventFilter(EventFilter eventFilter) Set the currentEventFilter.setEventHandler(EventHandler eventHandler) Set the currentEventHandler.setEventPersistence(Config.EventPersistence eventPersistence) Set the event persistence configuration.setEventSender(EventSender eventSender) Set the currentEventSender.setExceptionHandler(ExceptionHandler exceptionHandler) Set the currentExceptionHandler.setJmx(Config.Jmx jmxConfig) Set the JMX configuration.setMappingScannerEnabled(boolean mappingScannerEnabled) Enable or disable the mapping scanner.setMetadataScannersEnabled(boolean metadataScannerEnabled) Enable or disable the metadata scanners (mapping and configuration).setProperties(Map<String, Object> properties) Set runtime properties that can override default settings.setRuntimeScannerEnabled(boolean runtimeScannerEnabled) Enable or disable the runtime scanner.
-
Constructor Details
-
Config
public Config()Initializing constructor.
-
-
Method Details
-
getEventHandler
Get the currentEventHandler.- Returns:
- current
EventHandler
-
setEventHandler
Set the currentEventHandler.- Parameters:
eventHandler- currentEventHandler- Returns:
- this
Config
-
addEventHandler
Add the providedEventHandler.- Parameters:
eventHandler- providedEventHandler- Returns:
- this
Config
-
getEventFilter
Get the currentEventFilter.- Returns:
- current
EventFilter
-
setEventFilter
Set the currentEventFilter.- Parameters:
eventFilter- currentEventFilter- Returns:
- this
Config
-
getEventDecorator
Get the currentEventDecorator.- Returns:
- current
EventDecorator
-
setEventDecorator
Set the currentEventDecorator.- Parameters:
eventDecorator- currentEventDecorator- Returns:
- this
Config
-
getEventSender
Get the currentEventSender.- Returns:
- current
EventSender
-
setEventSender
Set the currentEventSender.- Parameters:
eventSender- currentEventSender- Returns:
- this
Config
-
getExceptionHandler
Get the currentExceptionHandler.- Returns:
- current
ExceptionHandler
-
setExceptionHandler
Set the currentExceptionHandler.- Parameters:
exceptionHandler- currentExceptionHandler- Returns:
- this
Config
-
isMappingScannerEnabled
public boolean isMappingScannerEnabled()Check if the mapping scanner enabled.- Returns:
- the mapping scanner is enabled
-
setMappingScannerEnabled
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
Enable or disable the configuration scanner.- Parameters:
configurationScannerEnabled- if the configuration scanner is to be enabled- Returns:
- this
Config
-
setMetadataScannersEnabled
Enable or disable the metadata scanners (mapping and configuration). This is equivalent to callingsetMappingScannerEnabled(boolean)andsetConfigurationScannerEnabled(boolean)with the currentconfigurationScannerEnabledargument.- 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
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
Enable or disable the banner printing.- Parameters:
bannerPrintingEnabled- if the banner printing is to be enabled- Returns:
- this
Config
-
getEventHandlers
Get theEventHandlerlist.- Returns:
- the
EventHandlerlist
-
getProperties
Get runtime properties that can override default settings.- Returns:
- runtime properties
-
setProperties
Set runtime properties that can override default settings.- Parameters:
properties- runtime properties- Returns:
- this
Config
-
getJmx
Get the JMX configuration.- Returns:
- the JMX configuration
-
setJmx
Set the JMX configuration.- Parameters:
jmxConfig- JMX configuration- Returns:
- this
Config
-
getEventPersistence
Get the event persistence configuration.- Returns:
- the event persistence configuration
-
setEventPersistence
Set the event persistence configuration. Providing a non-null, enabledConfig.EventPersistenceactivates the feature that stores the detected events into a database table over time.- Parameters:
eventPersistence- the event persistence configuration- Returns:
- this
Config
-
mergeProperties
Merge the JPAEntityManagerFactoryor the HibernateSessionFactoryproperties with the Hypersistence ones, and call thePropertiesSetterobjects.- Parameters:
factoryProperties- factory properties
-