Class ConfigurationSourceProperties
java.lang.Object
com.helger.config.source.AbstractConfigurationSource
com.helger.config.source.resource.AbstractConfigurationSourceResource
com.helger.config.source.resource.properties.ConfigurationSourceProperties
- All Implemented Interfaces:
IConfigurationSource,IIterableConfigurationSource,IConfigurationSourceResource,IConfigurationValueProvider
Implementation of
IConfigurationSource for properties file based configuration sources.- Author:
- Philip Helger
-
Field Summary
FieldsFields inherited from class com.helger.config.source.resource.AbstractConfigurationSourceResource
CONFIG_SOURCE_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationSourceProperties(int nPriority, com.helger.io.resource.IReadableResource aRes) Constructor with default charsetConfigurationSourceProperties(int nPriority, com.helger.io.resource.IReadableResource aRes, Charset aCharset) ConstructorConfigurationSourceProperties(com.helger.io.resource.IReadableResource aRes) Constructor with default priority and default charsetConfigurationSourceProperties(com.helger.io.resource.IReadableResource aRes, Charset aCharset) Constructor with default priority -
Method Summary
Modifier and TypeMethodDescriptionbooleangetConfigurationValue(String sKey) Get the configuration value with the provided key.inthashCode()booleancom.helger.base.state.ESuccessreload()Try to reload the configuration source from the configured resource.toString()Methods inherited from class com.helger.config.source.resource.AbstractConfigurationSourceResource
getResourceMethods inherited from class com.helger.config.source.AbstractConfigurationSource
getPriority, getSourceType, hasTrailingWhitespace, isSecretKey, mapToStringIgnoreSecretsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.config.source.IConfigurationSource
getPriority, getSourceTypeMethods inherited from interface com.helger.config.source.IIterableConfigurationSource
getAllConfiguredValues
-
Field Details
-
FILE_EXT
- See Also:
-
-
Constructor Details
-
ConfigurationSourceProperties
public ConfigurationSourceProperties(@Nonnull com.helger.io.resource.IReadableResource aRes) Constructor with default priority and default charset- Parameters:
aRes- Resource to read from. May not benull.
-
ConfigurationSourceProperties
public ConfigurationSourceProperties(@Nonnull com.helger.io.resource.IReadableResource aRes, @Nullable Charset aCharset) Constructor with default priority- Parameters:
aRes- Resource to read from. May not benull.aCharset- Character set to use. May benull.
-
ConfigurationSourceProperties
public ConfigurationSourceProperties(int nPriority, @Nonnull com.helger.io.resource.IReadableResource aRes) Constructor with default charset- Parameters:
nPriority- Configuration source priority.aRes- Resource to read from. May not benull.
-
ConfigurationSourceProperties
public ConfigurationSourceProperties(int nPriority, @Nonnull com.helger.io.resource.IReadableResource aRes, @Nullable Charset aCharset) Constructor- Parameters:
nPriority- Configuration source priority.aRes- Resource to read from. May not benull.aCharset- Character set to use. May benull.
-
-
Method Details
-
getCharset
- Returns:
- The charset used to load the properties. May be
null.
-
isInitializedAndUsable
public boolean isInitializedAndUsable()- Returns:
trueif the file was successfully initialized and can be used as a configuration source.
-
reload
@Nonnull public com.helger.base.state.ESuccess reload()Description copied from interface:IConfigurationSourceResourceTry to reload the configuration source from the configured resource. The reloading should be an atomic operation and be thread-safe.- Returns:
ESuccess.SUCCESSif the resource was found and loaded,ESuccess.FAILUREotherwise.
-
getConfigurationValue
Description copied from interface:IConfigurationValueProviderGet the configuration value with the provided key.- Parameters:
sKey- The key to be retrieved. May neither benullnor empty.- Returns:
nullif no such value is available.
-
getAllConfigItems
@Nonnull @ReturnsMutableCopy public com.helger.collection.commons.ICommonsOrderedMap<String,String> getAllConfigItems()- Returns:
- An ordered map of all contained keys and values in this resource.
The order of the items should follow the order of their declaration
in the underlying resource. Never
nullbut maybe empty.
-
equals
- Overrides:
equalsin classAbstractConfigurationSourceResource
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractConfigurationSourceResource
-
toString
- Overrides:
toStringin classAbstractConfigurationSourceResource
-