|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.configuration.AbstractConfiguration | +--org.apache.commons.configuration.SubsetConfiguration
A subset of another configuration. The new Configuration object contains every key from the parent Configuration that starts with prefix. The prefix is removed from the keys in the subset.
It is usually not necessary to use this class directly. Instead the
method should be used,
which will return a correctly initialized instance.Configuration.subset(String)
Field Summary | |
protected String |
delimiter
The prefix delimiter |
protected Configuration |
parent
The parent configuration. |
protected String |
prefix
The prefix used to select the properties. |
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
END_TOKEN, START_TOKEN |
Constructor Summary | |
SubsetConfiguration(Configuration parent,
String prefix)
Create a subset of the specified configuration |
|
SubsetConfiguration(Configuration parent,
String prefix,
String delimiter)
Create a subset of the specified configuration |
Method Summary | |
void |
addPropertyDirect(String key,
Object value)
{@inheritDoc} |
void |
clearProperty(String key)
{@inheritDoc} |
boolean |
containsKey(String key)
{@inheritDoc} |
protected String |
getChildKey(String key)
Return the key in the subset configuration associated to the specified key in the parent configuration. |
Iterator |
getKeys()
{@inheritDoc} |
Iterator |
getKeys(String prefix)
{@inheritDoc} |
Configuration |
getParent()
Return the parent configuation for this subset. |
protected String |
getParentKey(String key)
Return the key in the parent configuration associated to the specified key in this subset. |
String |
getPrefix()
Return the prefix used to select the properties in the parent configuration. |
Object |
getProperty(String key)
{@inheritDoc} |
protected String |
interpolate(String base)
{@inheritDoc} |
boolean |
isEmpty()
{@inheritDoc} |
boolean |
isThrowExceptionOnMissing()
{@inheritDoc} The subset inherits this feature from its parent if it supports this feature. |
void |
setPrefix(String prefix)
Set the prefix used to select the properties in the parent configuration. |
void |
setProperty(String key,
Object value)
{@inheritDoc} |
void |
setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
{@inheritDoc} Change the behaviour of the parent configuration if it supports this feature. |
Configuration |
subset(String prefix)
{@inheritDoc} |
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
addProperty, clear, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolateHelper, resolveContainerStore, setDelimiter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Configuration parent
protected String prefix
protected String delimiter
Constructor Detail |
public SubsetConfiguration(Configuration parent, String prefix)
parent
- The parent configurationprefix
- The prefix used to select the propertiespublic SubsetConfiguration(Configuration parent, String prefix, String delimiter)
parent
- The parent configurationprefix
- The prefix used to select the propertiesdelimiter
- The prefix delimiterMethod Detail |
protected String getParentKey(String key)
key
- The key in the subset.protected String getChildKey(String key)
key
- The key in the parent configuration.public Configuration getParent()
public String getPrefix()
public void setPrefix(String prefix)
prefix
- the prefixpublic Configuration subset(String prefix)
subset
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
prefix
- The prefix used to select the properties.SubsetConfiguration
public boolean isEmpty()
isEmpty
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
true
if the configuration contains no property,
false
otherwise.public boolean containsKey(String key)
containsKey
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- the key whose presence in this configuration is to be testedtrue
if the configuration contains a value for this
key, false
otherwisepublic void addPropertyDirect(String key, Object value)
addPropertyDirect
in class AbstractConfiguration
org.apache.commons.configuration.AbstractConfiguration
key
- key to use for mappingvalue
- object to storepublic void setProperty(String key, Object value)
setProperty
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- The key of the property to changevalue
- The new valuepublic void clearProperty(String key)
clearProperty
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
key
- the key to remove along with corresponding value.public Object getProperty(String key)
org.apache.commons.configuration.Configuration
key
- property to retrievepublic Iterator getKeys(String prefix)
getKeys
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
prefix
- The prefix to test against.Configuration.getKeys()
public Iterator getKeys()
getKeys
in class AbstractConfiguration
org.apache.commons.configuration.Configuration
protected String interpolate(String base)
interpolate
in class AbstractConfiguration
org.apache.commons.configuration.AbstractConfiguration
base
- string to interpolatepublic void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
setThrowExceptionOnMissing
in class AbstractConfiguration
org.apache.commons.configuration.AbstractConfiguration
throwExceptionOnMissing
- The new value for the propertypublic boolean isThrowExceptionOnMissing()
isThrowExceptionOnMissing
in class AbstractConfiguration
org.apache.commons.configuration.AbstractConfiguration
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |