com.jdon.util.jdom
类 XMLProperties

java.lang.Object
  继承者 com.jdon.util.jdom.XMLProperties

public class XMLProperties
extends Object

Provides the the ability to use simple XML property files. Each property is in the form X.Y.Z, which would map to an XML snippet of:

 <X>
     <Y>
         <Z>someValue</Z>
     </Y>
 </X>
 
The XML file is passed in to the constructor and must be readable and writtable. Setting property values will automatically persist those value to disk or outputStream.


构造方法摘要
XMLProperties(InputStream inputStream)
          Creates a new XMLProperties object.
XMLProperties(String fileName)
          Creates a new XMLProperties object.
 
方法摘要
 void deleteProperty(String name)
          Deletes the specified property.
 String[] getChildrenProperties(String parent)
          Return all children property names of a parent property as a String array, or an empty array if the if there are no children.
 String[] getChildrenPropertiesValues(String parent)
           
 String getProperty(String name)
          Returns the value of the specified property.
 void setProperty(String name, String value)
          Sets the value of the specified property.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

XMLProperties

public XMLProperties(String fileName)
Creates a new XMLProperties object.


XMLProperties

public XMLProperties(InputStream inputStream)
Creates a new XMLProperties object.

方法详细信息

getProperty

public String getProperty(String name)
Returns the value of the specified property.

参数:
name - the name of the property to get.
返回:
the value of the specified property.

getChildrenProperties

public String[] getChildrenProperties(String parent)
Return all children property names of a parent property as a String array, or an empty array if the if there are no children. For example, given the properties X.Y.A, X.Y.B, and X.Y.C, then the child properties of X.Y are A, B, and C.

参数:
parent - the name of the parent property.
返回:
all child property values for the given parent.

getChildrenPropertiesValues

public String[] getChildrenPropertiesValues(String parent)

setProperty

public void setProperty(String name,
                        String value)
Sets the value of the specified property. If the property doesn't currently exist, it will be automatically created.

参数:
name - the name of the property to set.
value - the new value for the property.

deleteProperty

public void deleteProperty(String name)
Deletes the specified property.

参数:
name - the property to delete.


Copyright © 2013. All Rights Reserved.