|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jostraca.util.PropertySet
Stores an editable list of name-value pairs.
Example
PropertySet mps = new PropertySet();
mps.load( "foo = bar \n"
+"white = black \n"
);
PropertySet ps = (PropertySet) mps;
ps.has( "foo" ); // returns true
String bar = ps.get( "foo" ); // returns "bar"
String[] names = ps.getNames(); // returns ["foo","white"]
WARNING
| Field Summary | |
static java.lang.String |
CN
|
static java.lang.String |
END_angle
|
static java.lang.String |
END_brace
|
static java.lang.String |
MOD_escape
|
static java.lang.String |
MOD_remove_backslash
|
static java.lang.String |
MOD_trim
|
static java.lang.String |
NO_SUBSTITUTIONS_SUFFIX
|
static java.lang.String |
START_angle
|
static java.lang.String |
START_brace
|
| Constructor Summary | |
PropertySet()
Create an empty PropertySet. |
|
PropertySet(java.io.File pFile)
Create a PropertySet from a file. |
|
PropertySet(java.util.Hashtable pHashtable)
Create from a Hashtable. |
|
PropertySet(java.util.Map pMap)
Create from a Map. |
|
PropertySet(java.lang.Object[] pNameValuePairs)
Create from an Object[]. |
|
PropertySet(PropertySet pPropertySet)
Create from a PropertySet. |
|
PropertySet(java.lang.String pFilePath)
Create a PropertySet from a file path. |
|
| Method Summary | |
void |
clear()
Clear all name-value pairs. |
java.lang.Object |
clone()
Clone ProperySet. |
boolean |
contains(PropertySet pPropertySet)
True if specified PropertySet is contained in this PropertySet. |
void |
copy(java.lang.String pFromName,
java.lang.String pToName)
Copy a value from one name to another. |
boolean |
equals(java.lang.Object pObject)
True if specified Object is equal to this PropertySet. |
java.lang.String |
get(java.lang.String pName)
Get a value by name, return empty String if undefined. |
java.lang.String |
get(java.lang.String pName,
java.lang.String pDefault)
Get a value by name, return default if not defined. |
java.lang.String[] |
getList(java.lang.String pName,
java.lang.String pSeparationChars)
Get a list of values. |
java.lang.String[] |
getNames()
Get a String array of names. |
java.util.Enumeration |
getNamesEnum()
Get an Enumeration of names. |
java.util.List |
getNamesList()
Get a List of names. |
java.lang.String |
getSourceValue(java.lang.String pName)
Get property value without performing substitutions. |
java.lang.String[] |
getValues()
Get a String array of values. |
java.util.Enumeration |
getValuesEnum()
Get an Enumeration of values. |
boolean |
has(java.lang.String pName)
True if name exists. |
void |
inheritFrom(PropertySet pPropertySet)
Inherit name-value pairs from a different PropertySet. |
java.lang.String |
insertValues(java.lang.String pText)
Insert values by $ |
boolean |
isDefined(java.lang.String pName)
Return true if name has a non empty value. |
boolean |
isNo(java.lang.String pName)
True if property has a no or false value. |
boolean |
isYes(java.lang.String pName)
True if property has an yes or true value. |
void |
load(java.io.File pFile)
Parse file into name-value pairs. |
void |
load(java.lang.String pFilePath)
Parse file into name-value pairs. |
void |
overrideWith(PropertySet pPropertySet)
Override name-value pairs with name-value pairs from a different PropertySet. |
void |
parse(java.lang.String pText)
Parse Text into name-value pairs. |
void |
replaceAll(java.lang.String pFrom,
java.lang.String pTo)
Make a global replacement accross all properties. |
void |
save(java.io.File pFile)
Save property set to disk. |
void |
save(java.lang.String pFilePath)
Save property set to disk. |
void |
set(java.lang.Object pName,
java.lang.Object pValue)
Set name-value pair. |
void |
set(PropertySet pPropertySet)
Set from a different PropertySet. |
void |
set(java.lang.String pName,
boolean pValue)
Set name-value pair. |
int |
size()
Get number of names. |
java.lang.String |
toString()
Return a String representation of data. |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String CN
public static final java.lang.String NO_SUBSTITUTIONS_SUFFIX
public static final java.lang.String START_angle
public static final java.lang.String START_brace
public static final java.lang.String END_angle
public static final java.lang.String END_brace
public static final java.lang.String MOD_escape
public static final java.lang.String MOD_remove_backslash
public static final java.lang.String MOD_trim
| Constructor Detail |
public PropertySet()
public PropertySet(java.io.File pFile)
pFile - File containing properties.public PropertySet(java.lang.String pFilePath)
pFilePath - path to filepublic PropertySet(java.util.Hashtable pHashtable)
pHashtable - property names and valuespublic PropertySet(java.util.Map pMap)
pMap - property names and valuespublic PropertySet(java.lang.Object[] pNameValuePairs)
pNameValuePairs - property names and valuespublic PropertySet(PropertySet pPropertySet)
pPropertySet - property names and values| Method Detail |
public java.lang.String get(java.lang.String pName)
getSourceValue(java.lang.String)
to get the value without substitutions.
pName - name of value
public java.lang.String get(java.lang.String pName,
java.lang.String pDefault)
pName - name of valuepDefault - default value
public java.lang.String[] getList(java.lang.String pName,
java.lang.String pSeparationChars)
pName - name of value listpSeparationChars - list of chars on which to splitpublic java.lang.String getSourceValue(java.lang.String pName)
pName - name of valuepublic boolean has(java.lang.String pName)
pName - Name to test.public java.lang.String[] getNames()
public java.lang.String[] getValues()
public java.util.Enumeration getNamesEnum()
public java.util.List getNamesList()
public java.util.Enumeration getValuesEnum()
public boolean isYes(java.lang.String pName)
pName - name to testpublic boolean isNo(java.lang.String pName)
pName - name to testpublic boolean isDefined(java.lang.String pName)
pName - name to testpublic int size()
public java.lang.Object clone()
public java.lang.String toString()
public void save(java.lang.String pFilePath)
pFilePath - path to save properties topublic void save(java.io.File pFile)
pFile - File to save properties topublic boolean equals(java.lang.Object pObject)
pObject - Object to testpublic boolean contains(PropertySet pPropertySet)
pPropertySet - PropertySet to test
public void set(java.lang.String pName,
boolean pValue)
pName - namepValue - boolean value
public void set(java.lang.Object pName,
java.lang.Object pValue)
pName - namepValue - valuepublic void set(PropertySet pPropertySet)
pPropertySet - names and values to copy
public void replaceAll(java.lang.String pFrom,
java.lang.String pTo)
public void copy(java.lang.String pFromName,
java.lang.String pToName)
pFromName - name to take value frompToName - name to set value ofpublic void clear()
public void parse(java.lang.String pText)
throws PropertySetException
pText - text to parse
PropertySetExceptionpublic void load(java.lang.String pFilePath)
pFilePath - path of file to parsepublic void load(java.io.File pFile)
pFile - File to parse.public void overrideWith(PropertySet pPropertySet)
pPropertySet - PropertySet to override this onepublic void inheritFrom(PropertySet pPropertySet)
pPropertySet - PropertySet to inherit this one.public java.lang.String insertValues(java.lang.String pText)
pText - String to perform subsitutions on
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||