|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.HsqlProperties
Wrapper for java.util.Properties to limit values to Specific types and allow saving and loading.
Is public because it is used in the org.hsqldb.test package.
Field Summary | |
protected int[] |
errorCodes
|
protected String[] |
errorKeys
|
protected String |
fileName
|
static int |
NO_VALUE_FOR_KEY
|
protected boolean |
resource
|
protected Properties |
stringProps
|
Constructor Summary | |
HsqlProperties()
|
|
HsqlProperties(Properties props)
|
|
HsqlProperties(String name)
|
|
HsqlProperties(String name,
boolean b)
|
Method Summary | |
void |
addProperties(HsqlProperties props)
|
void |
addProperties(Properties props)
|
static HsqlProperties |
argArrayToProps(String[] arg,
String type)
Creates and populates an HsqlProperties Object from the arguments array of a Main method. |
boolean |
checkFileExists()
|
static boolean |
checkFileExists(String fileName,
boolean resource,
Class cla)
|
static HsqlProperties |
delimitedArgPairsToProps(String s,
String pairsep,
String dlimiter,
String type)
Creates and populates a new HsqlProperties Object using a string such as "key1=value1;key2=value2" The string that represents the = sign above is specified as pairsep and the one that represents the semicolon is specified as delimiter, allowing any string to be used for either. |
int |
getIntegerProperty(String key,
int defaultValue)
|
int |
getIntegerProperty(String key,
int defaultValue,
int minimum,
int maximum)
|
Properties |
getProperties()
|
String |
getProperty(String key)
|
String |
getProperty(String key,
String defaultValue)
|
boolean |
isEmpty()
|
boolean |
isPropertyTrue(String key)
|
boolean |
isPropertyTrue(String key,
boolean defaultValue)
|
boolean |
load()
|
static void |
main(String[] argv)
|
Enumeration |
propertyNames()
|
void |
removeProperty(String key)
|
void |
save()
Saves the properties using JDK2 method if present, otherwise JDK1. |
void |
setFileName(String name)
|
String |
setProperty(String key,
boolean value)
|
String |
setProperty(String key,
int value)
|
String |
setProperty(String key,
String value)
|
String |
setPropertyIfNotExists(String key,
String value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int NO_VALUE_FOR_KEY
protected String fileName
protected Properties stringProps
protected int[] errorCodes
protected String[] errorKeys
protected boolean resource
Constructor Detail |
public HsqlProperties()
public HsqlProperties(String name)
public HsqlProperties(String name, boolean b)
public HsqlProperties(Properties props)
Method Detail |
public void setFileName(String name)
public String setProperty(String key, int value)
public String setProperty(String key, boolean value)
public String setProperty(String key, String value)
public String setPropertyIfNotExists(String key, String value)
public Properties getProperties()
public String getProperty(String key)
public String getProperty(String key, String defaultValue)
public int getIntegerProperty(String key, int defaultValue)
public int getIntegerProperty(String key, int defaultValue, int minimum, int maximum)
public boolean isPropertyTrue(String key)
public boolean isPropertyTrue(String key, boolean defaultValue)
public void removeProperty(String key)
public void addProperties(Properties props)
public void addProperties(HsqlProperties props)
public boolean checkFileExists() throws IOException
IOException
public static boolean checkFileExists(String fileName, boolean resource, Class cla) throws IOException
IOException
public boolean load() throws Exception
Exception
public void save() throws Exception
Exception
public static HsqlProperties argArrayToProps(String[] arg, String type)
"-?" is treated as a key with no value and not inserted.
public static HsqlProperties delimitedArgPairsToProps(String s, String pairsep, String dlimiter, String type)
The string that represents the = sign above is specified as pairsep and the one that represents the semicolon is specified as delimiter, allowing any string to be used for either.
Leading / trailing spaces around the keys and values are discarded.
The string is parsed by (1) subdividing into segments by delimiter (2) subdividing each segment in two by finding the first instance of the pairsep (3) trimming each pair of segments from step 2 and inserting into the properties object.
Each key is prefixed with the type argument and a dot before being inserted.
Any key without a value is added to the list of errors.
public Enumeration propertyNames()
public boolean isEmpty()
public static void main(String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |