public class ConfigValidatorImpl extends Object implements ConfigValidator
ConfigValidatorImpl
Modifier and Type | Field and Description |
---|---|
static String |
PROP_VALIDATOR_ACTIVATOR
Boolean property to activate the fact that invalid config a blokking issues is. |
Constructor and Description |
---|
ConfigValidatorImpl(List<String> expectedProps) |
ConfigValidatorImpl(List<String> expectedProps,
Configuration config) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
Property contains key.
|
Boolean |
getBooleanProperty(String key,
Boolean defaultValue)
Gets the boolean property.
|
Configuration |
getConfig() |
Configuration |
getCurrentConfig() |
Duration |
getDurationProperty(String key,
Long defaultValue,
TimeUnit defaultTimeUnit) |
Integer |
getIntegerProperty(String key,
Integer defaultValue)
Gets the integer property.
|
Long |
getLongProperty(String key,
Long defaultValue)
Gets the long property.
|
List<String> |
getMatchingProperties(String rootKey)
Gets the properties that match a root key.
|
String |
getProperty(String key)
Gets the property by Key from the DEFAULT_CONFIG.
|
String |
getProperty(String key,
String defaultValue)
Gets the property by Key.
|
List<Object> |
getUnfoundPropertiesAfterValidation()
will do the validation of the current config ( if not done yet ) and return the properties that were not found.
|
URL |
getURLProperty(String property)
Gets the uRL property.
|
boolean |
hasDurationProperty(String key) |
boolean |
hasMatchingProperty(String rootKey) |
boolean |
hasProperty(String key)
Checks for property.
|
void |
invalidate()
Method to invalidate all the cached configuration.
|
void |
invalidateCache()
This method will invalidate the current config.
|
boolean |
isReloading() |
boolean |
isValid() |
void |
reload()
Method to reload the configuration modules.
|
void |
setProperty(String key,
String value)
Method to override a property at runtime.
|
public static final String PROP_VALIDATOR_ACTIVATOR
Boolean
property to activate the fact that invalid config a blokking issues is. If this property is TRUE then a
ConfigurationException
will be throw when the config is invalid.
Default value is TRUE.
public ConfigValidatorImpl(List<String> expectedProps, Configuration config)
public final Configuration getConfig() throws TechnicalConnectorException
getConfig
in interface ConfigValidator
TechnicalConnectorException
public List<Object> getUnfoundPropertiesAfterValidation() throws TechnicalConnectorException
ConfigValidator
getUnfoundPropertiesAfterValidation
in interface ConfigValidator
TechnicalConnectorException
- if exception occurs while initializeing config.public final boolean isValid() throws TechnicalConnectorException
isValid
in interface ConfigValidator
TechnicalConnectorException
public final void invalidateCache()
ConfigValidator
invalidateCache
in interface ConfigValidator
public final String getProperty(String key, String defaultValue)
Configuration
getProperty
in interface Configuration
key
- the keydefaultValue
- the default valuepublic final Long getLongProperty(String key, Long defaultValue)
Configuration
getLongProperty
in interface Configuration
key
- the keydefaultValue
- the default valuepublic final Integer getIntegerProperty(String key, Integer defaultValue)
Configuration
getIntegerProperty
in interface Configuration
key
- the keydefaultValue
- the default valuepublic final Boolean getBooleanProperty(String key, Boolean defaultValue)
Configuration
getBooleanProperty
in interface Configuration
key
- the keydefaultValue
- the default valuepublic Duration getDurationProperty(String key, Long defaultValue, TimeUnit defaultTimeUnit)
getDurationProperty
in interface Configuration
public boolean hasDurationProperty(String key)
hasDurationProperty
in interface Configuration
public final String getProperty(String key)
Configuration
getProperty
in interface Configuration
key
- the keypublic final boolean containsKey(String key)
Configuration
containsKey
in interface Configuration
key
- the keypublic final URL getURLProperty(String property)
Configuration
getURLProperty
in interface Configuration
property
- the stringpublic final void setProperty(String key, String value)
Configuration
setProperty
in interface Configuration
key
- the keyvalue
- the valuepublic final boolean hasProperty(String key)
Configuration
hasProperty
in interface Configuration
key
- the keypublic boolean hasMatchingProperty(String rootKey)
hasMatchingProperty
in interface Configuration
public final List<String> getMatchingProperties(String rootKey)
Configuration
getMatchingProperties
in interface Configuration
rootKey
- the root keypublic final Configuration getCurrentConfig()
getCurrentConfig
in interface Configuration
public void invalidate() throws TechnicalConnectorException
Configuration
invalidate
in interface Configuration
TechnicalConnectorException
public void reload() throws TechnicalConnectorException
Configuration
This method must be called when you change properties at runtime that are used by configuration modules.
reload
in interface Configuration
TechnicalConnectorException
public boolean isReloading()
isReloading
in interface Configuration
Connector Packaging TECHNICAL 4.3.0-beta-3 API
Copyright © {inceptionYear}-2022 eHealth. All Rights Reserved.