public class PropertyManager
extends java.lang.Object
At the moment, properties are stored in a Java Properties file. In a version of PropertyManager coming soon, the properties file format will move to XML. XML properties will allow hierarchical property structures which may mean the API of this class will have to change.
PropertyManager properties are only meant to be set and retrevied by core PropertyManager classes. Therefore, skin writers should probably ignore this class.
This class is implemented as a singleton since many classloaders seem to take issue with doing classpath resource loading from a static context.
| 限定符和类型 | 字段和说明 |
|---|---|
protected static org.slf4j.Logger |
log |
java.lang.String |
m_strPropsName |
| 构造器和说明 |
|---|
PropertyManager(java.lang.String strResourceURI)
Creates a new PropertyManager.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
deleteProp(java.lang.String strName) |
void |
deleteProperty(java.lang.String strName)
Deletes a PropertyManager property.
|
protected java.lang.String |
getProp(java.lang.String strName)
Gets a PropertyManager property.
|
java.lang.String |
getProperty(java.lang.String strName)
Returns a PropertyManager property.
|
boolean |
getPropertyBoolean(java.lang.String strName,
boolean bDefaultValue)
取属性管理器中的boolean 型属性.
|
double |
getPropertyDouble(java.lang.String strName,
double fDefaultValue)
取属性管理器中的Double 型属性.
|
int |
getPropertyInt(java.lang.String strName,
int nDefaultValue)
取属性管理器中的int 型属性.
|
long |
getPropertyLong(java.lang.String strName,
long lDefaultValue)
取属性管理器中的long 型属性.
|
java.lang.String |
getPropertyManagerVersion()
Returns the version number of PropertyManager as a String. i.e. -- major.minor.revision
|
int |
getPropertyManagerVersionMajor()
Returns the major version number of PropertyManager. i.e. -- 1.x.x
|
int |
getPropertyManagerVersionMinor()
Returns the minor version number of PropertyManager. i.e. -- x.1.x
|
int |
getPropertyManagerVersionRevision()
Returns the revision version number of PropertyManager. i.e. -- x.x.1
|
boolean |
loadResource(java.lang.String strResourceURI)
装载资源数据。
|
boolean |
propertyFileExists()
Returns true if the PropertyManager.properties file exists where the path property
purports that it does.
|
boolean |
propertyFileIsReadable()
Returns true if the properties are readable.
|
boolean |
propertyFileIsWritable()
Returns true if the properties are writable.
|
java.util.Enumeration |
propertyNames()
Returns the names of the PropertyManager properties.
|
java.lang.String[] |
propertyNamesArray() |
java.lang.String[] |
propertyNamesArray(boolean bDESC) |
boolean |
propFileExists()
Returns true if the PropertyManager.properties file exists where the path property
purports that it does.
|
boolean |
propFileIsReadable()
Returns true if the properties are readable.
|
boolean |
propFileIsWritable()
Returns true if the properties are writable.
|
protected java.util.Enumeration |
propNames() |
protected void |
setProp(java.lang.String strName,
java.lang.String strValue)
Sets a PropertyManager property.
|
void |
setProperty(java.lang.String strName,
boolean bValue)
设置属性管理器中的boolean 型属性.
|
void |
setProperty(java.lang.String strName,
double fValue)
设置属性管理器中的Double 型属性.
|
void |
setProperty(java.lang.String strName,
int nValue)
设置属性管理器中的int 型属性.
|
void |
setProperty(java.lang.String strName,
long lValue)
设置属性管理器中的long 型属性.
|
void |
setProperty(java.lang.String strName,
java.lang.String strValue)
Sets a PropertyManager property.
|
protected static final org.slf4j.Logger log
public java.lang.String m_strPropsName
public PropertyManager(java.lang.String strResourceURI)
public java.lang.String getProperty(java.lang.String strName)
strName - the name of the property to return.public double getPropertyDouble(java.lang.String strName,
double fDefaultValue)
Returns a PropertyManager double property.
strName - 要返回的属性名.fDefaultValue - 当指定名字的属性不存在或不是合法的double类型时返回的值.public boolean getPropertyBoolean(java.lang.String strName,
boolean bDefaultValue)
Returns a PropertyManager boolean property.
strName - 要返回的属性名.bDefaultValue - 当指定名字的属性不存在或不是合法的boolean类型时返回的值.public int getPropertyInt(java.lang.String strName,
int nDefaultValue)
Returns a PropertyManager int property.
strName - 要返回的属性名.nDefaultValue - 当指定名字的属性不存在或不是合法的int类型时返回的值.public long getPropertyLong(java.lang.String strName,
long lDefaultValue)
Returns a PropertyManager long property.
strName - 要返回的属性名.lDefaultValue - 当指定名字的属性不存在或不是合法的int类型时返回的值.public void setProperty(java.lang.String strName,
java.lang.String strValue)
strName - the name of the property being set.strValue - the value of the property being set.public void setProperty(java.lang.String strName,
double fValue)
strName - 需要设置的属性名.fValue - double类型的属性值.public void setProperty(java.lang.String strName,
boolean bValue)
strName - 需要设置的属性名.bValue - boolean类型的属性值.public void setProperty(java.lang.String strName,
int nValue)
strName - 需要设置的属性名.nValue - int类型的属性值.public void setProperty(java.lang.String strName,
long lValue)
strName - 需要设置的属性名.lValue - long类型的属性值.public void deleteProperty(java.lang.String strName)
strName - the name of the property to delete.public java.util.Enumeration propertyNames()
public java.lang.String[] propertyNamesArray()
public java.lang.String[] propertyNamesArray(boolean bDESC)
public boolean propertyFileIsReadable()
public boolean propertyFileIsWritable()
public boolean propertyFileExists()
public java.lang.String getPropertyManagerVersion()
public int getPropertyManagerVersionMajor()
public int getPropertyManagerVersionMinor()
public int getPropertyManagerVersionRevision()
public boolean loadResource(java.lang.String strResourceURI)
strResourceURI - 资源路径,一般为 /xxx.propertiesprotected java.lang.String getProp(java.lang.String strName)
strName - the name of the property to get.protected void setProp(java.lang.String strName,
java.lang.String strValue)
protected void deleteProp(java.lang.String strName)
protected java.util.Enumeration propNames()
public boolean propFileIsReadable()
public boolean propFileExists()
public boolean propFileIsWritable()
Copyright © 2001-2014 hynnet.com