|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.craftforge.commons.configuration.PropertiesHolder
public class PropertiesHolder
A properties holder provides a convenient way of accessing a properties resource.
| Constructor Summary | |
|---|---|
PropertiesHolder(String resource)
Initializes the properties holder from a resource. |
|
| Method Summary | |
|---|---|
protected Class<?> |
createClass(String propertyName,
Class<?> defaultClass)
Creates a class from a property using a default class if the property is not set. |
protected Map<String,String> |
createMap(String prefix)
Creates a map of properties which match the given property name prefix. |
Class<?> |
getClass(String propertyName,
Class<?> defaultClass)
Gets a class from a property if the property value represents a class path known to class loader. |
Map<String,String> |
getProperties(String propertyNamePrefix)
Gets a map of properties which match the given property name prefix. |
String |
getProperty(String propertyName)
Gets a property from the holder or manually added properties. |
protected void |
removeClass(String propertyName)
Removes the class associated to the given property name from the caching map. |
protected void |
removeMaps(String propertyName)
Removes all maps associated to all possible prefixes of the given property name from the caching map. |
void |
setProperties(String propertyNamePrefix,
Map<String,String> properties)
Sets the properties in the given property map and puts the given property name prefix before to the property name keys. |
void |
setProperty(String propertyName,
String propertyValue)
Sets a property of the given name to the given value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertiesHolder(String resource)
resource - The resource| Method Detail |
|---|
public String getProperty(String propertyName)
propertyName - The property name
public void setProperty(String propertyName,
String propertyValue)
propertyName - The property namepropertyValue - The property value
public void setProperties(String propertyNamePrefix,
Map<String,String> properties)
propertyNamePrefix - The property name prefixproperties - The property mappublic Map<String,String> getProperties(String propertyNamePrefix)
Gets a map of properties which match the given property name prefix.
Example:
my.property.KEY_ONE = value1
my.property.KEY_TWO = value2
my.property -> { KEY_ONE : value1 ; KEY_TWO : value2 }
propertyNamePrefix - The property name prefix
public Class<?> getClass(String propertyName,
Class<?> defaultClass)
propertyName - The property namedefaultClass - The default class to return if the property is not set
protected Class<?> createClass(String propertyName,
Class<?> defaultClass)
propertyName - The property namedefaultClass - The default class
protected Map<String,String> createMap(String prefix)
prefix - The property name prefix
protected void removeClass(String propertyName)
propertyName - The property nameprotected void removeMaps(String propertyName)
propertyName - The property name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||