Class PropertiesConfigurationHelper
- java.lang.Object
-
- net.obvj.confectory.internal.helper.BasicConfigurationHelper<Properties>
-
- net.obvj.confectory.internal.helper.PropertiesConfigurationHelper
-
- All Implemented Interfaces:
ConfigurationDataRetriever<Properties>,ConfigurationHelper<Properties>
public class PropertiesConfigurationHelper extends BasicConfigurationHelper<Properties>
A specialized Configuration Helper that retrieves data from aPropertiesobject.- Since:
- 0.1.0
- Author:
- oswaldo.bapvic.jr (Oswaldo Junior)
-
-
Constructor Summary
Constructors Constructor Description PropertiesConfigurationHelper(Properties properties)Builds a new dedicated instance from a specificPropertiesobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationMerger<Properties>configurationMerger()Creates the applicableConfigurationMergerobject for the type associated with thisConfigurationHelper.Objectget(String key)Returns the object associated with the specifiedkey.StringgetAsString()Returns a string representation of the bean used by this data retriever, typically for manual handling and/or troubleshooting purposes.StringgetMandatoryString(String key)Returns theStringobject associated with the specifiedkey, throwing an exception if not found.StringgetString(String key)Returns theStringobject associated with the specifiedkey.-
Methods inherited from class net.obvj.confectory.internal.helper.BasicConfigurationHelper
getBean, getBoolean, getDouble, getInteger, getLong, getMandatoryBoolean, getMandatoryDouble, getMandatoryInteger, getMandatoryLong
-
-
-
-
Constructor Detail
-
PropertiesConfigurationHelper
public PropertiesConfigurationHelper(Properties properties)
Builds a new dedicated instance from a specificPropertiesobject.- Parameters:
properties- thePropertiesto be maintained by this helper
-
-
Method Detail
-
getAsString
public String getAsString()
Description copied from interface:ConfigurationDataRetrieverReturns a string representation of the bean used by this data retriever, typically for manual handling and/or troubleshooting purposes.- Returns:
- a string representation of the configuration bean (Note: it can be
nullif theConfigurationis marked as optional)
-
get
public Object get(String key)
Description copied from interface:ConfigurationDataRetrieverReturns the object associated with the specifiedkey.Notes:
- The actual return type may vary depending on the underlying implementation
- On a JSON implementation, the return will usually be an array
- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the object object associated with the specified
key. Depending on the actual implementation, the result may be eithernullor an empty array if the specified key is not found
-
getString
public String getString(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theStringobject associated with the specifiedkey.- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Stringobject associated with the specifiedkey;nullif not found
-
getMandatoryString
public String getMandatoryString(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theStringobject associated with the specifiedkey, throwing an exception if not found.- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Stringobject associated with the specifiedkey; nevernull
-
configurationMerger
public ConfigurationMerger<Properties> configurationMerger()
Description copied from interface:ConfigurationHelperCreates the applicableConfigurationMergerobject for the type associated with thisConfigurationHelper.- Returns:
- a new
ConfigurationMergerinstance
-
-