|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.javadocking.util.PropertiesUtil
public class PropertiesUtil
This class contains a collection of static utility methods for creating, retrieving, saving and loading properties.
Field Summary | |
---|---|
static java.lang.String |
FALSE
The string representation for the boolean FALSE value. |
static java.lang.String |
TRUE
The string representation for the boolean TRUE value. |
Method Summary | |
---|---|
static boolean |
getBoolean(java.util.Properties properties,
java.lang.String name,
boolean defaultValue)
Gets the boolean property with the given name. |
static java.awt.Color |
getColor(java.util.Properties properties,
java.lang.String name,
java.awt.Color defaultValue)
Gets the color property with the given name. |
static double |
getDouble(java.util.Properties properties,
java.lang.String name,
double defaultValue)
Gets the double property with the given name. |
static double[] |
getDoubleArray(java.util.Properties properties,
java.lang.String name,
double[] defaultValue)
Gets the double array property with the given name. |
static int |
getInteger(java.util.Properties properties,
java.lang.String name,
int defaultValue)
Gets the integer property with the given name. |
static int[] |
getIntegerArray(java.util.Properties properties,
java.lang.String name,
int[] defaultValue)
Gets the integer array property with the given name. |
static java.lang.String |
getString(java.util.Properties properties,
java.lang.String name,
java.lang.String defaultValue)
Gets the string property with the given name. |
static java.lang.String[] |
getStringArray(java.util.Properties properties,
java.lang.String name,
java.lang.String[] defaultValue)
Gets the string array property with the given name. |
static java.util.Properties |
loadProperties(java.lang.String sourceName)
Reads the file with the given name into a java.util.Properties object. |
static void |
saveProperties(java.util.Properties properties,
java.lang.String destinationName,
java.lang.String comment)
Saves the given java.util.Properties object in a destination file with the given name. |
static void |
setBoolean(java.util.Properties properties,
java.lang.String name,
boolean value)
Adds the boolean property with the given name and value to the given properties. |
static void |
setColor(java.util.Properties properties,
java.lang.String name,
java.awt.Color value)
Adds the color property with the given name and value to the given properties. |
static void |
setDouble(java.util.Properties properties,
java.lang.String name,
double value)
Adds the double property with the given name and value to the given properties. |
static void |
setDoubleArray(java.util.Properties properties,
java.lang.String name,
double[] value)
Adds the double array property with the given name and value to the given properties. |
static void |
setInteger(java.util.Properties properties,
java.lang.String name,
int value)
Adds the integer property with the given name and value to the given properties. |
static void |
setIntegerArray(java.util.Properties properties,
java.lang.String name,
int[] value)
Adds the integer array property with the given name and value to the given properties. |
static void |
setString(java.util.Properties properties,
java.lang.String name,
java.lang.String value)
Adds the string property with the given name and value to the given properties. |
static void |
setStringArray(java.util.Properties properties,
java.lang.String name,
java.lang.String[] value)
Adds the string array property with the given name and value to the given properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TRUE
public static final java.lang.String FALSE
Method Detail |
---|
public static java.util.Properties loadProperties(java.lang.String sourceName) throws java.io.IOException
sourceName
- The name of the source file for the properties.
java.io.IOException
- If creating the input stream, reading the property list from the input stream
or closing the input stream throws an IOException.public static void saveProperties(java.util.Properties properties, java.lang.String destinationName, java.lang.String comment) throws java.io.IOException
properties
- The properties that have to be saved in the destination file.destinationName
- The name of the destination file for the properties.comment
- The saved file will start with the given text as comment.
java.lang.NullPointerException
- If the given properties are null.
java.io.IOException
- If creating the output stream, writing this property list
to the output stream or closing the output stream throws an IOException.public static boolean getBoolean(java.util.Properties properties, java.lang.String name, boolean defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setBoolean(java.util.Properties properties, java.lang.String name, boolean value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static java.lang.String getString(java.util.Properties properties, java.lang.String name, java.lang.String defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setString(java.util.Properties properties, java.lang.String name, java.lang.String value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static int getInteger(java.util.Properties properties, java.lang.String name, int defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setInteger(java.util.Properties properties, java.lang.String name, int value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static double getDouble(java.util.Properties properties, java.lang.String name, double defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setDouble(java.util.Properties properties, java.lang.String name, double value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static java.awt.Color getColor(java.util.Properties properties, java.lang.String name, java.awt.Color defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setColor(java.util.Properties properties, java.lang.String name, java.awt.Color value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static java.lang.String[] getStringArray(java.util.Properties properties, java.lang.String name, java.lang.String[] defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setStringArray(java.util.Properties properties, java.lang.String name, java.lang.String[] value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static int[] getIntegerArray(java.util.Properties properties, java.lang.String name, int[] defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setIntegerArray(java.util.Properties properties, java.lang.String name, int[] value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.public static double[] getDoubleArray(java.util.Properties properties, java.lang.String name, double[] defaultValue)
properties
- The given properties where the property is searched.name
- The name of the property.defaultValue
- The default value of the property.
public static void setDoubleArray(java.util.Properties properties, java.lang.String name, double[] value)
properties
- The given properties to which the property is added.name
- The name of the property.value
- The default value of the property.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |