Package com.suse.common.configuration
Class BaseConfigurationSource
- java.lang.Object
-
- com.suse.common.configuration.BaseConfigurationSource
-
- All Implemented Interfaces:
ConfigurationSource
- Direct Known Subclasses:
EnvironmentConfigurationSource,FileConfigurationSource,ResourceConfigurationSource
public abstract class BaseConfigurationSource extends java.lang.Object implements ConfigurationSource
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.lang.String>TRUE_VALUES
-
Constructor Summary
Constructors Constructor Description BaseConfigurationSource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <T> TconvertTo(java.lang.String value, java.lang.Class<T> valueClass)java.util.Optional<java.lang.Boolean>getBoolean(java.lang.String property)Retrieve the boolean value of a property.java.util.Optional<java.lang.Double>getDouble(java.lang.String property)Retrieve the double value of a property.java.util.Optional<java.lang.Float>getFloat(java.lang.String property)Retrieve the float value of a property.java.util.Optional<java.lang.Integer>getInteger(java.lang.String property)Retrieve the integer value of a property.<T> java.util.Optional<java.util.List<T>>getList(java.lang.String property, java.lang.Class<T> itemClass)Retrieve the list value of a property.java.util.Optional<java.lang.Long>getLong(java.lang.String property)Retrieve the long value of a property.protected abstract java.lang.StringgetRawValue(java.lang.String property)java.util.Optional<java.lang.String>getString(java.lang.String property)Retrieve the string value of a property.java.util.PropertiestoProperties()Converts this configuration source to aPropertiesobject.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.suse.common.configuration.ConfigurationSource
getPropertyNames
-
-
-
-
Method Detail
-
getString
public java.util.Optional<java.lang.String> getString(java.lang.String property)
Description copied from interface:ConfigurationSourceRetrieve the string value of a property.- Specified by:
getStringin interfaceConfigurationSource- Parameters:
property- the property name- Returns:
- the string wrapped into an
Optional
-
getInteger
public java.util.Optional<java.lang.Integer> getInteger(java.lang.String property)
Description copied from interface:ConfigurationSourceRetrieve the integer value of a property.- Specified by:
getIntegerin interfaceConfigurationSource- Parameters:
property- the property name- Returns:
- the integer wrapped into an
Optional
-
getLong
public java.util.Optional<java.lang.Long> getLong(java.lang.String property)
Description copied from interface:ConfigurationSourceRetrieve the long value of a property.- Specified by:
getLongin interfaceConfigurationSource- Parameters:
property- the property name- Returns:
- the long wrapped into an
Optional
-
getFloat
public java.util.Optional<java.lang.Float> getFloat(java.lang.String property)
Description copied from interface:ConfigurationSourceRetrieve the float value of a property.- Specified by:
getFloatin interfaceConfigurationSource- Parameters:
property- the property name- Returns:
- the float wrapped into an
Optional
-
getDouble
public java.util.Optional<java.lang.Double> getDouble(java.lang.String property)
Description copied from interface:ConfigurationSourceRetrieve the double value of a property.- Specified by:
getDoublein interfaceConfigurationSource- Parameters:
property- the property name- Returns:
- the double wrapped into an
Optional
-
getBoolean
public java.util.Optional<java.lang.Boolean> getBoolean(java.lang.String property)
Description copied from interface:ConfigurationSourceRetrieve the boolean value of a property.- Specified by:
getBooleanin interfaceConfigurationSource- Parameters:
property- the property name- Returns:
- the boolean wrapped into an
Optional
-
getList
public <T> java.util.Optional<java.util.List<T>> getList(java.lang.String property, java.lang.Class<T> itemClass)Description copied from interface:ConfigurationSourceRetrieve the list value of a property.- Specified by:
getListin interfaceConfigurationSource- Type Parameters:
T- the type of item of the list- Parameters:
property- the property nameitemClass- the type of item of the list.- Returns:
- the list wrapped into an
Optional
-
toProperties
public java.util.Properties toProperties()
Description copied from interface:ConfigurationSourceConverts this configuration source to aPropertiesobject.- Specified by:
toPropertiesin interfaceConfigurationSource- Returns:
- all the properties value stored into
Propertiesobject
-
getRawValue
protected abstract java.lang.String getRawValue(java.lang.String property)
-
convertTo
protected <T> T convertTo(java.lang.String value, java.lang.Class<T> valueClass)
-
-