Class BeanConfigurationHelper<T>
- java.lang.Object
-
- net.obvj.confectory.internal.helper.BasicConfigurationHelper<T>
-
- net.obvj.confectory.internal.helper.BeanConfigurationHelper<T>
-
- Type Parameters:
T- the configuration bean type
- All Implemented Interfaces:
ConfigurationDataRetriever<T>,ConfigurationHelper<T>
public class BeanConfigurationHelper<T> extends BasicConfigurationHelper<T>
A Configuration Helper implementation for user-defined beans.- Since:
- 0.1.0
- Author:
- oswaldo.bapvic.jr (Oswaldo Junior)
-
-
Constructor Summary
Constructors Constructor Description BeanConfigurationHelper(T source)Builds a new Configuration Helper instance with a specific source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationMerger<T>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
-
BeanConfigurationHelper
public BeanConfigurationHelper(T source)
Builds a new Configuration Helper instance with a specific source.- Parameters:
source- the source bean, mainly for exception/reporting purposes
-
-
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- not used since this method implementation is a "no-op"- 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 - Throws:
ConfigurationException- always, since the data for this type of helper should be retrieved by the user-defined bean
-
getString
public String getString(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theStringobject associated with the specifiedkey.- Parameters:
key- not used since this method implementation is a "no-op"- Returns:
- the
Stringobject associated with the specifiedkey;nullif not found - Throws:
ConfigurationException- always, since the data for this type of helper should be retrieved by the user-defined bean
-
getMandatoryString
public String getMandatoryString(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theStringobject associated with the specifiedkey, throwing an exception if not found.- Parameters:
key- not used since this method implementation is a "no-op"- Returns:
- the
Stringobject associated with the specifiedkey; nevernull - Throws:
ConfigurationException- always, since the data for this type of helper should be retrieved by the user-defined bean
-
configurationMerger
public ConfigurationMerger<T> configurationMerger()
Description copied from interface:ConfigurationHelperCreates the applicableConfigurationMergerobject for the type associated with thisConfigurationHelper.- Returns:
- a new
ConfigurationMergerinstance
-
-