Class NullConfigurationHelper<T>
- java.lang.Object
-
- net.obvj.confectory.internal.helper.NullConfigurationHelper<T>
-
- Type Parameters:
T- the source type which configuration data is to be retrieved
- All Implemented Interfaces:
ConfigurationDataRetriever<T>,ConfigurationHelper<T>
public class NullConfigurationHelper<T> extends Object implements ConfigurationHelper<T>
A "no-op" Configuration Helper object for situations where an optionalConfigurationobject is not available.- Since:
- 0.1.0
- Author:
- oswaldo.bapvic.jr (Oswaldo Junior)
-
-
Constructor Summary
Constructors Constructor Description NullConfigurationHelper()Builds aNullConfigurationHelper.NullConfigurationHelper(ConfigurationHelper<T> originalHelper)Builds aNullConfigurationHelperwith a reference to the original/expectedConfigurationHelper.
-
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.TgetBean()Returns the configuration bean used by this data retriever, typically for manual handling and/or troubleshooting purposes.BooleangetBoolean(String key)Returns theBooleanobject associated with the specifiedkey.DoublegetDouble(String key)Returns theDoubleobject associated with the specifiedkey.IntegergetInteger(String key)Returns theIntegerobject associated with the specifiedkey.LonggetLong(String key)Returns theLongobject associated with the specifiedkey.BooleangetMandatoryBoolean(String key)Returns theBooleanobject associated with the specifiedkey, throwing an exception if not found.DoublegetMandatoryDouble(String key)Returns theDoubleobject associated with the specifiedkey, throwing an exception if not found.IntegergetMandatoryInteger(String key)Returns theIntegerobject associated with the specifiedkey, throwing an exception if not found.LonggetMandatoryLong(String key)Returns theLongobject associated with the specifiedkey, throwing an exception if not found.StringgetMandatoryString(String key)Returns theStringobject associated with the specifiedkey, throwing an exception if not found.StringgetString(String key)Returns theStringobject associated with the specifiedkey.
-
-
-
Constructor Detail
-
NullConfigurationHelper
public NullConfigurationHelper()
Builds aNullConfigurationHelper.- Since:
- 2.2.0
-
NullConfigurationHelper
public NullConfigurationHelper(ConfigurationHelper<T> originalHelper)
Builds aNullConfigurationHelperwith a reference to the original/expectedConfigurationHelper.- Parameters:
originalHelper- the initialConfigurationHelperthat should be applied if the actual bean was available- Since:
- 2.2.0
-
-
Method Detail
-
getBean
public T getBean()
Description copied from interface:ConfigurationDataRetrieverReturns the configuration bean used by this data retriever, typically for manual handling and/or troubleshooting purposes.- Specified by:
getBeanin interfaceConfigurationDataRetriever<T>- Returns:
null, always
-
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.- Specified by:
getAsStringin interfaceConfigurationDataRetriever<T>- Returns:
null, always
-
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
- Specified by:
getin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
null, always
-
getBoolean
public Boolean getBoolean(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theBooleanobject associated with the specifiedkey.- Specified by:
getBooleanin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
null, always (not to be interpreted asfalse)
-
getInteger
public Integer getInteger(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theIntegerobject associated with the specifiedkey.- Specified by:
getIntegerin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath- Returns:
null, always
-
getLong
public Long getLong(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theLongobject associated with the specifiedkey.- Specified by:
getLongin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath- Returns:
null, always
-
getDouble
public Double getDouble(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theDoubleobject associated with the specifiedkey.- Specified by:
getDoublein interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath- Returns:
null, always
-
getString
public String getString(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theStringobject associated with the specifiedkey.- Specified by:
getStringin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
null, always
-
getMandatoryBoolean
public Boolean getMandatoryBoolean(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theBooleanobject associated with the specifiedkey, throwing an exception if not found.- Specified by:
getMandatoryBooleanin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Booleanvalue associated with the specifiedkey; nevernull - Throws:
ConfigurationException- always
-
getMandatoryInteger
public Integer getMandatoryInteger(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theIntegerobject associated with the specifiedkey, throwing an exception if not found.- Specified by:
getMandatoryIntegerin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Integerobject associated with the specifiedkey; nevernull - Throws:
ConfigurationException- always
-
getMandatoryLong
public Long getMandatoryLong(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theLongobject associated with the specifiedkey, throwing an exception if not found.- Specified by:
getMandatoryLongin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Longobject associated with the specifiedkey; nevernull - Throws:
ConfigurationException- always
-
getMandatoryDouble
public Double getMandatoryDouble(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theDoubleobject associated with the specifiedkey, throwing an exception if not found.- Specified by:
getMandatoryDoublein interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Doubleobject associated with the specifiedkey; nevernull - Throws:
ConfigurationException- always
-
getMandatoryString
public String getMandatoryString(String key)
Description copied from interface:ConfigurationDataRetrieverReturns theStringobject associated with the specifiedkey, throwing an exception if not found.- Specified by:
getMandatoryStringin interfaceConfigurationDataRetriever<T>- Parameters:
key- the object key (some implementations may also accept a path expression, e.g:JSONPath)- Returns:
- the
Stringobject associated with the specifiedkey; nevernull - Throws:
ConfigurationException- always
-
configurationMerger
public ConfigurationMerger<T> configurationMerger()
Description copied from interface:ConfigurationHelperCreates the applicableConfigurationMergerobject for the type associated with thisConfigurationHelper.- Specified by:
configurationMergerin interfaceConfigurationHelper<T>- Returns:
- a new
ConfigurationMergerinstance - Throws:
UnsupportedOperationException- if no original helper is specified for thisNullConfigurationHelper.
-
-