Package org.hobbit.utils.config
Class HobbitConfiguration
java.lang.Object
org.apache.commons.configuration2.event.BaseEventSource
org.apache.commons.configuration2.AbstractConfiguration
org.apache.commons.configuration2.CompositeConfiguration
org.hobbit.utils.config.HobbitConfiguration
- All Implemented Interfaces:
Cloneable,org.apache.commons.configuration2.Configuration,org.apache.commons.configuration2.event.EventSource,org.apache.commons.configuration2.ImmutableConfiguration,org.apache.commons.configuration2.sync.SynchronizerSupport
public class HobbitConfiguration
extends org.apache.commons.configuration2.CompositeConfiguration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(String name) Returns the value of the environmental variable with the given name asbooleanor throws anIllegalStateExceptionif the variable can not be found or an error occurs.booleangetBoolean(String name, boolean defaultValue) Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.booleangetBoolean(String name, boolean defaultValue, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.booleangetBoolean(String name, Supplier<Boolean> defaultValueFactory) Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.booleangetBoolean(String name, Supplier<Boolean> defaultValueFactory, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.booleangetBoolean(String name, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asbooleanor throws anIllegalStateExceptionif the variable can not be found or an error occurs.protected booleangetBooleanValue(String name, boolean defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) Internal method defining the default value factory function before callinggetBooleanValue(String, Supplier, Logger, boolean).protected booleangetBooleanValue(String name, Supplier<Boolean> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).intReturns the value of the environmental variable with the given name asintor throws anIllegalStateExceptionif the variable can not be found or an error occurs.intReturns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.intReturns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.intReturns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.intReturns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.intReturns the value of the environmental variable with the given name asintor throws anIllegalStateExceptionif the variable can not be found or an error occurs.protected intgetIntValue(String name, int defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) Internal method defining the default value factory function before callinggetIntValue(String, Supplier, Logger, boolean).protected intgetIntValue(String name, Supplier<Integer> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).longReturns the value of the environmental variable with the given name aslongor throws anIllegalStateExceptionif the variable can not be found or an error occurs.longReturns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.longReturns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.longReturns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.longReturns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.longReturns the value of the environmental variable with the given name aslongor throws anIllegalStateExceptionif the variable can not be found or an error occurs.protected longgetLongValue(String name, long defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) Internal method defining the default value factory function before callinggetLongValue(String, Supplier, Logger, boolean).protected longgetLongValue(String name, Supplier<Long> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).org.apache.jena.rdf.model.ModelReturns the value of the environmental variable with the given name asModelor throws anIllegalStateExceptionif the variable can not be found or an error occurs.org.apache.jena.rdf.model.ModelReturns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.org.apache.jena.rdf.model.ModelgetModel(String name, Supplier<org.apache.jena.rdf.model.Model> defaultValueFactory, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.org.apache.jena.rdf.model.ModelReturns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.org.apache.jena.rdf.model.ModelReturns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.org.apache.jena.rdf.model.ModelReturns the value of the environmental variable with the given name asModelor throws anIllegalStateExceptionif the variable can not be found or an error occurs.protected org.apache.jena.rdf.model.ModelgetModelValue(String name, Supplier<org.apache.jena.rdf.model.Model> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).protected org.apache.jena.rdf.model.ModelgetModelValue(String name, org.apache.jena.rdf.model.Model defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) Internal method defining the default value factory function before callinggetModelValue(String, Supplier, Logger, boolean).Returns the value of the environmental variable with the given name asStringor throws anIllegalStateExceptionif the variable can not be found or an error occurs.Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.Returns the value of the environmental variable with the given name asStringor throws anIllegalStateExceptionif the variable can not be found or an error occurs.protected StringgetStringValue(String name, String defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) Internal method defining the default value factory function before callinggetStringValue(String, Supplier, Logger, boolean).protected StringgetStringValue(String name, Supplier<String> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).protected <T> TgetVariableValue(String name, Function<String, T> conversion, Supplier<T> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) Generic method for accessing an environmental variable which has the given name and will be transformed into the return type using the given conversion function.Methods inherited from class org.apache.commons.configuration2.CompositeConfiguration
addConfiguration, addConfiguration, addPropertyDirect, clearInternal, clearPropertyDirect, clone, containsKeyInternal, getConfiguration, getInMemoryConfiguration, getKeysInternal, getKeysInternal, getList, getNumberOfConfigurations, getPropertyInternal, getSource, getStringArray, isEmptyInternal, removeConfiguration, setListDelimiterHandlerMethods inherited from class org.apache.commons.configuration2.AbstractConfiguration
addErrorLogListener, addProperty, addPropertyInternal, append, beginRead, beginWrite, clear, clearProperty, cloneInterpolator, containsKey, copy, endRead, endWrite, get, get, getArray, getArray, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getByte, getByte, getByte, getCollection, getCollection, getConfigurationDecoder, getConversionHandler, getDouble, getDouble, getDouble, getEncodedString, getEncodedString, getFloat, getFloat, getFloat, getInteger, getInterpolator, getKeys, getKeys, getList, getList, getList, getListDelimiterHandler, getLogger, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getSynchronizer, immutableSubset, initLogger, installInterpolator, interpolate, interpolate, interpolatedConfiguration, isEmpty, isScalarValue, isThrowExceptionOnMissing, lock, setConfigurationDecoder, setConversionHandler, setDefaultLookups, setInterpolator, setLogger, setParentInterpolator, setPrefixLookups, setProperty, setPropertyInternal, setSynchronizer, setThrowExceptionOnMissing, size, sizeInternal, subset, unlockMethods inherited from class org.apache.commons.configuration2.event.BaseEventSource
addEventListener, clearErrorListeners, clearEventListeners, copyEventListeners, createErrorEvent, createEvent, fireError, fireEvent, getEventListenerRegistrations, getEventListeners, isDetailEvents, removeEventListener, setDetailEvents
-
Constructor Details
-
HobbitConfiguration
public HobbitConfiguration()
-
-
Method Details
-
getVariableValue
protected <T> T getVariableValue(String name, Function<String, T> conversion, Supplier<T> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) throws IllegalStateExceptionGeneric method for accessing an environmental variable which has the given name and will be transformed into the return type using the given conversion function. The behavior in case of an error is defined by the given default value andLoggerobjects. If a problem occurs and aLoggeris available, the error will be logged using theLogger.error(String)method. If exceptionWhenFailing is set totrueanIllegalStateExceptionis thrown. Else, if a defaultValueFactory is available, a default value will be returned. Otherwisenullis returned.- Parameters:
name- name of the environmental variable which should be accessedconversion- the function which is used to convert theStringof the variable value into the expected value type. It is assumed that this function will throw an exception if an error occurs.defaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getString
Returns the value of the environmental variable with the given name asStringor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Specified by:
getStringin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getStringin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accessed- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getString
Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.- Specified by:
getStringin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getStringin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getString
Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getString
Returns the value of the environmental variable with the given name asStringor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accessedlogger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getString
Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getString
Returns the value of the environmental variable with the given name asStringor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getStringValue
protected String getStringValue(String name, String defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) throws IllegalStateException Internal method defining the default value factory function before callinggetStringValue(String, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.hasDefaultValue- flag indicating whether a default value has been provided.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getStringValue
protected String getStringValue(String name, Supplier<String> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) throws IllegalStateException Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getModel
Returns the value of the environmental variable with the given name asModelor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accessed- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getModel
public org.apache.jena.rdf.model.Model getModel(String name, org.apache.jena.rdf.model.Model defaultValue) Returns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getModel
public org.apache.jena.rdf.model.Model getModel(String name, Supplier<org.apache.jena.rdf.model.Model> defaultValueFactory) Returns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getModel
public org.apache.jena.rdf.model.Model getModel(String name, org.slf4j.Logger logger) throws IllegalStateException Returns the value of the environmental variable with the given name asModelor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accessedlogger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getModel
public org.apache.jena.rdf.model.Model getModel(String name, org.apache.jena.rdf.model.Model defaultValue, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getModel
public org.apache.jena.rdf.model.Model getModel(String name, Supplier<org.apache.jena.rdf.model.Model> defaultValueFactory, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asModelor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getModelValue
protected org.apache.jena.rdf.model.Model getModelValue(String name, org.apache.jena.rdf.model.Model defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) throws IllegalStateException Internal method defining the default value factory function before callinggetModelValue(String, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.hasDefaultValue- flag indicating whether a default value has been provided.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getModelValue
protected org.apache.jena.rdf.model.Model getModelValue(String name, Supplier<org.apache.jena.rdf.model.Model> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) throws IllegalStateException Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getInt
Returns the value of the environmental variable with the given name asintor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Specified by:
getIntin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getIntin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accessed- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getInt
Returns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.- Specified by:
getIntin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getIntin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getInt
Returns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getInt
Returns the value of the environmental variable with the given name asintor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accessedlogger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getInt
Returns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getInt
Returns the value of the environmental variable with the given name asintor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getIntValue
protected int getIntValue(String name, int defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) throws IllegalStateException Internal method defining the default value factory function before callinggetIntValue(String, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.hasDefaultValue- flag indicating whether a default value has been provided.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getIntValue
protected int getIntValue(String name, Supplier<Integer> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) throws IllegalStateException Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getLong
Returns the value of the environmental variable with the given name aslongor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Specified by:
getLongin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getLongin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accessed- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getLong
Returns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.- Specified by:
getLongin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getLongin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getLong
Returns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getLong
Returns the value of the environmental variable with the given name aslongor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accessedlogger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getLong
Returns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getLong
Returns the value of the environmental variable with the given name aslongor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getLongValue
protected long getLongValue(String name, long defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) throws IllegalStateException Internal method defining the default value factory function before callinggetLongValue(String, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.hasDefaultValue- flag indicating whether a default value has been provided.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getLongValue
protected long getLongValue(String name, Supplier<Long> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) throws IllegalStateException Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getBoolean
Returns the value of the environmental variable with the given name asbooleanor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Specified by:
getBooleanin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getBooleanin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accessed- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getBoolean
Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.- Specified by:
getBooleanin interfaceorg.apache.commons.configuration2.ImmutableConfiguration- Overrides:
getBooleanin classorg.apache.commons.configuration2.AbstractConfiguration- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getBoolean
Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getBoolean
Returns the value of the environmental variable with the given name asbooleanor throws anIllegalStateExceptionif the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accessedlogger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value
- Throws:
IllegalStateException- if the variable can not be found or an error occurs.
-
getBoolean
Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getBoolean
public boolean getBoolean(String name, Supplier<Boolean> defaultValueFactory, org.slf4j.Logger logger) Returns the value of the environmental variable with the given name asbooleanor the default value if the variable can not be found or an error occurs.- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.- Returns:
- the variable value or the default value if an error occurred and a default value is available.
-
getBooleanValue
protected boolean getBooleanValue(String name, boolean defaultValue, org.slf4j.Logger logger, boolean exceptionWhenFailing, boolean hasDefaultValue) throws IllegalStateException Internal method defining the default value factory function before callinggetBooleanValue(String, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValue- the default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.hasDefaultValue- flag indicating whether a default value has been provided.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-
getBooleanValue
protected boolean getBooleanValue(String name, Supplier<Boolean> defaultValueFactory, org.slf4j.Logger logger, boolean exceptionWhenFailing) throws IllegalStateException Internal method defining the conversion function before callinggetVariableValue(String, Function, Supplier, Logger, boolean).- Parameters:
name- name of the environmental variable which should be accesseddefaultValueFactory- A factory method which can be used to generate a default value which will be returned if the variable can not be found or if an error occurs.logger- theLoggerwhich will be used to log errors if they occur.exceptionWhenFailing- flag indicating whether an exception should be thrown if an error occurs.- Returns:
- the variable value converted to the expected value or the default value if an error occurred and a default value is available.
- Throws:
IllegalStateException- if exceptionWhenFailing is set totrueand one of the following two errors occurs: 1) the variable is not available or 2) the conversion function throws an exception.
-