Class AbstractConfiguration<T extends org.apache.commons.configuration.Configuration>
- java.lang.Object
-
- dev.aherscu.qa.testing.utils.config.AbstractConfiguration<T>
-
- Type Parameters:
T
- type of wrapped configuration
- Direct Known Subclasses:
BaseConfiguration
public abstract class AbstractConfiguration<T extends org.apache.commons.configuration.Configuration> extends Object implements org.apache.commons.configuration.Configuration, Map<Object,Object>
Makes aConfiguration
look like aMap
.- Author:
- aherscu
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIGURATION_SOURCES
The configuration sources.protected T
wrappedConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractConfiguration(T wrappedConfiguration)
Builds a configuration.
-
Method Summary
-
-
-
Field Detail
-
CONFIGURATION_SOURCES
public static final String CONFIGURATION_SOURCES
The configuration sources.- See Also:
- Constant Field Values
-
wrappedConfiguration
protected final T extends org.apache.commons.configuration.Configuration wrappedConfiguration
-
-
Constructor Detail
-
AbstractConfiguration
protected AbstractConfiguration(T wrappedConfiguration)
Builds a configuration.- Parameters:
wrappedConfiguration
- the configuration to wrap
-
-
Method Detail
-
defaultConfiguration
public static org.apache.commons.configuration.Configuration defaultConfiguration() throws org.apache.commons.configuration.ConfigurationException
- Returns:
- configuration per
CONFIGURATION_SOURCES
- Throws:
org.apache.commons.configuration.ConfigurationException
- if an error occurs
-
resolve
public String resolve(Object value)
Resolves references in a string.- Parameters:
value
- the value to process afterObject.toString()
is called- Returns:
- the supplied value with all its
${...}
references resolved
-
stringResourceFrom
protected String stringResourceFrom(String path)
Reads string contents of referenced resource.- Parameters:
path
- the path from root of classes- Returns:
- the string contents
- Throws:
NullPointerException
- if the resource could not be found or not enough privileges to access
-
subset
public org.apache.commons.configuration.Configuration subset(String arg0)
- Specified by:
subset
in interfaceorg.apache.commons.configuration.Configuration
-
isEmpty
public boolean isEmpty()
-
containsKey
public boolean containsKey(String arg0)
- Specified by:
containsKey
in interfaceorg.apache.commons.configuration.Configuration
-
addProperty
public void addProperty(String arg0, Object arg1)
- Specified by:
addProperty
in interfaceorg.apache.commons.configuration.Configuration
-
setProperty
public void setProperty(String arg0, Object arg1)
- Specified by:
setProperty
in interfaceorg.apache.commons.configuration.Configuration
-
clearProperty
public void clearProperty(String arg0)
- Specified by:
clearProperty
in interfaceorg.apache.commons.configuration.Configuration
-
clear
public void clear()
-
getProperty
public Object getProperty(String arg0)
- Specified by:
getProperty
in interfaceorg.apache.commons.configuration.Configuration
-
getKeys
public Iterator<String> getKeys(String arg0)
- Specified by:
getKeys
in interfaceorg.apache.commons.configuration.Configuration
-
getKeys
public Iterator<String> getKeys()
- Specified by:
getKeys
in interfaceorg.apache.commons.configuration.Configuration
-
getProperties
public Properties getProperties(String arg0)
- Specified by:
getProperties
in interfaceorg.apache.commons.configuration.Configuration
-
getBoolean
public boolean getBoolean(String arg0)
- Specified by:
getBoolean
in interfaceorg.apache.commons.configuration.Configuration
-
getBoolean
public boolean getBoolean(String arg0, boolean arg1)
- Specified by:
getBoolean
in interfaceorg.apache.commons.configuration.Configuration
-
getBoolean
public Boolean getBoolean(String arg0, Boolean arg1)
- Specified by:
getBoolean
in interfaceorg.apache.commons.configuration.Configuration
-
getByte
public byte getByte(String arg0)
- Specified by:
getByte
in interfaceorg.apache.commons.configuration.Configuration
-
getByte
public byte getByte(String arg0, byte arg1)
- Specified by:
getByte
in interfaceorg.apache.commons.configuration.Configuration
-
getByte
public Byte getByte(String arg0, Byte arg1)
- Specified by:
getByte
in interfaceorg.apache.commons.configuration.Configuration
-
getDouble
public double getDouble(String arg0)
- Specified by:
getDouble
in interfaceorg.apache.commons.configuration.Configuration
-
getDouble
public double getDouble(String arg0, double arg1)
- Specified by:
getDouble
in interfaceorg.apache.commons.configuration.Configuration
-
getDouble
public Double getDouble(String arg0, Double arg1)
- Specified by:
getDouble
in interfaceorg.apache.commons.configuration.Configuration
-
getFloat
public float getFloat(String arg0)
- Specified by:
getFloat
in interfaceorg.apache.commons.configuration.Configuration
-
getFloat
public float getFloat(String arg0, float arg1)
- Specified by:
getFloat
in interfaceorg.apache.commons.configuration.Configuration
-
getFloat
public Float getFloat(String arg0, Float arg1)
- Specified by:
getFloat
in interfaceorg.apache.commons.configuration.Configuration
-
getInt
public int getInt(String arg0)
- Specified by:
getInt
in interfaceorg.apache.commons.configuration.Configuration
-
getInt
public int getInt(String arg0, int arg1)
- Specified by:
getInt
in interfaceorg.apache.commons.configuration.Configuration
-
getInteger
public Integer getInteger(String arg0, Integer arg1)
- Specified by:
getInteger
in interfaceorg.apache.commons.configuration.Configuration
-
getLong
public long getLong(String arg0)
- Specified by:
getLong
in interfaceorg.apache.commons.configuration.Configuration
-
getLong
public long getLong(String arg0, long arg1)
- Specified by:
getLong
in interfaceorg.apache.commons.configuration.Configuration
-
getLong
public Long getLong(String arg0, Long arg1)
- Specified by:
getLong
in interfaceorg.apache.commons.configuration.Configuration
-
getShort
public short getShort(String arg0)
- Specified by:
getShort
in interfaceorg.apache.commons.configuration.Configuration
-
getShort
public short getShort(String arg0, short arg1)
- Specified by:
getShort
in interfaceorg.apache.commons.configuration.Configuration
-
getShort
public Short getShort(String arg0, Short arg1)
- Specified by:
getShort
in interfaceorg.apache.commons.configuration.Configuration
-
getBigDecimal
public BigDecimal getBigDecimal(String arg0)
- Specified by:
getBigDecimal
in interfaceorg.apache.commons.configuration.Configuration
-
getBigDecimal
public BigDecimal getBigDecimal(String arg0, BigDecimal arg1)
- Specified by:
getBigDecimal
in interfaceorg.apache.commons.configuration.Configuration
-
getBigInteger
public BigInteger getBigInteger(String arg0)
- Specified by:
getBigInteger
in interfaceorg.apache.commons.configuration.Configuration
-
getBigInteger
public BigInteger getBigInteger(String arg0, BigInteger arg1)
- Specified by:
getBigInteger
in interfaceorg.apache.commons.configuration.Configuration
-
getString
public String getString(String arg0)
- Specified by:
getString
in interfaceorg.apache.commons.configuration.Configuration
-
getString
public String getString(String arg0, String arg1)
- Specified by:
getString
in interfaceorg.apache.commons.configuration.Configuration
-
getStringArray
public String[] getStringArray(String arg0)
- Specified by:
getStringArray
in interfaceorg.apache.commons.configuration.Configuration
-
getList
public List<Object> getList(String arg0)
- Specified by:
getList
in interfaceorg.apache.commons.configuration.Configuration
-
getList
public List<Object> getList(String arg0, List<?> arg1)
- Specified by:
getList
in interfaceorg.apache.commons.configuration.Configuration
-
containsKey
public boolean containsKey(Object arg0)
- Specified by:
containsKey
in interfaceMap<Object,Object>
-
containsValue
public boolean containsValue(Object arg0)
- Specified by:
containsValue
in interfaceMap<Object,Object>
-
getOrDefault
public Object getOrDefault(Object key, Object defaultValue)
- Specified by:
getOrDefault
in interfaceMap<Object,Object>
-
forEach
public void forEach(BiConsumer<? super Object,? super Object> action)
-
replaceAll
public void replaceAll(BiFunction<? super Object,? super Object,?> function)
- Specified by:
replaceAll
in interfaceMap<Object,Object>
-
putIfAbsent
public Object putIfAbsent(Object key, Object value)
- Specified by:
putIfAbsent
in interfaceMap<Object,Object>
-
computeIfAbsent
public Object computeIfAbsent(Object key, Function<? super Object,?> mappingFunction)
- Specified by:
computeIfAbsent
in interfaceMap<Object,Object>
-
computeIfPresent
public Object computeIfPresent(Object key, BiFunction<? super Object,? super Object,?> remappingFunction)
- Specified by:
computeIfPresent
in interfaceMap<Object,Object>
-
compute
public Object compute(Object key, BiFunction<? super Object,? super Object,?> remappingFunction)
-
-