public abstract class PropertyUtilities extends Object
Properties
Modifier and Type | Class and Description |
---|---|
static class |
PropertyUtilities.PropertyTable
Creates a TableModel from a property set
|
static class |
PropertyUtilities.TranslatedProperties
A Properties object whose values and defaults are automatically
translated if they contain {prop} tokens.
|
Constructor and Description |
---|
PropertyUtilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getBoolean(Properties prop,
String key,
boolean def) |
static Color |
getColor(Properties prop,
String key,
Color def) |
static double |
getDouble(Properties prop,
String key,
double def) |
static float |
getFloat(Properties prop,
String key,
float def) |
static int |
getInteger(Properties prop,
String key) |
static int |
getInteger(Properties prop,
String key,
int def) |
static long |
getLong(Properties prop,
String key,
long def) |
static Rectangle |
getRectangle(Properties prop,
String key,
Rectangle def) |
static String |
getString(Properties prop,
String key,
String def) |
static String[] |
getStringArray(Properties prop,
String key,
String[] def) |
static Collection |
getStringCollection(Properties prop,
String key,
Collection def) |
static URL |
getURL(Properties prop,
String key,
URL def)
Load a URL from a properties file.
|
static void |
setBoolean(Properties prop,
String key,
boolean value) |
static void |
setBoolean(Properties prop,
String key,
Boolean value) |
static void |
setColor(Properties prop,
String key,
Color c) |
static void |
setDouble(Properties prop,
String key,
double f)
Stores double value.
|
static void |
setDouble(Properties prop,
String key,
Double value)
Stores double value.
|
static void |
setFloat(Properties prop,
String key,
float f)
Stores float value.
|
static void |
setFloat(Properties prop,
String key,
Float value)
Stores float value.
|
static void |
setInteger(Properties prop,
String key,
int i)
Stores integer value.
|
static void |
setInteger(Properties prop,
String key,
Integer value)
Stores integer value.
|
static void |
setLong(Properties prop,
String key,
long i)
Stores long value.
|
static void |
setLong(Properties prop,
String key,
Long value)
Stores long value.
|
static void |
setRectangle(Properties prop,
String key,
Rectangle rect) |
static void |
setString(Properties prop,
String key,
String s) |
static void |
setStringArray(Properties prop,
String key,
String[] sa) |
static void |
setStringCollection(Properties prop,
String key,
Collection sa) |
static void |
setURL(Properties prop,
String key,
URL url) |
static boolean |
touchBoolean(Properties prop,
String key,
boolean defaultValue)
Returns boolean value stored in the specified properties set with the
given key.
|
static Color |
touchColor(Properties prop,
String key,
Color defaultValue)
Returns Color stored in the specified properties set with the
given key.
|
static double |
touchDouble(Properties prop,
String key,
double defaultValue)
Returns double value stored in the specified properties set with
the given key.
|
static float |
touchFloat(Properties prop,
String key,
float defaultValue)
Returns float value stored in the specified properties set with
the given key.
|
static int |
touchInteger(Properties prop,
String key,
int defaultValue)
Returns int value stored in the specified properties set with
the given key.
|
static long |
touchLong(Properties prop,
String key,
long defaultValue)
Returns long value stored in the specified properties set with
the given key.
|
static Rectangle |
touchRectangle(Properties prop,
String key,
Rectangle defaultValue)
Returns Rectangle stored in the specified properties set with
the given key.
|
static String |
touchString(Properties prop,
String key,
String defaultValue)
Returns String stored in the specified properties set with the
given key.
|
static String[] |
touchStringArray(Properties prop,
String key,
String[] defaultValue)
Returns String array stored in the specified properties set with
the given key.
|
static Collection |
touchStringCollection(Properties prop,
String key,
Collection defaultValue)
Returns String collection stored in the specified properties set with the
given key.
|
static URL |
touchURL(Properties prop,
String key,
URL defaultValue)
Returns URL value stored in the specified properties set with
the given key.
|
static String |
translate(Properties prop,
String in)
Translates a string by substituting tokens of the form {name} to the
value of property name in the properties set.
|
public static Rectangle getRectangle(Properties prop, String key, Rectangle def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static Rectangle touchRectangle(Properties prop, String key, Rectangle defaultValue)
public static void setRectangle(Properties prop, String key, Rectangle rect)
prop
- The Properties setkey
- the key used to store this propertyrect
- the value to storepublic static Color getColor(Properties prop, String key, Color def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static Color touchColor(Properties prop, String key, Color defaultValue)
public static void setColor(Properties prop, String key, Color c)
prop
- The Properties setkey
- the key used to store this propertyc
- the value to storepublic static Collection getStringCollection(Properties prop, String key, Collection def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static Collection touchStringCollection(Properties prop, String key, Collection defaultValue)
public static void setStringCollection(Properties prop, String key, Collection sa)
prop
- The Properties setkey
- the key used to store this propertysa
- the value to storepublic static String[] getStringArray(Properties prop, String key, String[] def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static String[] touchStringArray(Properties prop, String key, String[] defaultValue)
public static void setStringArray(Properties prop, String key, String[] sa)
prop
- The Properties setkey
- the key used to store this propertysa
- the value to storepublic static String getString(Properties prop, String key, String def)
prop
- The Properties setkey
- the key used to store this propertydefaultValue
- a default in case the property cannot be retrievedpublic static String touchString(Properties prop, String key, String defaultValue)
public static void setString(Properties prop, String key, String s)
prop
- The Properties setkey
- the key used to store this propertys
- the value to storepublic static boolean getBoolean(Properties prop, String key, boolean def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static boolean touchBoolean(Properties prop, String key, boolean defaultValue)
public static void setBoolean(Properties prop, String key, Boolean value)
prop
- The Properties setkey
- the key used to store this propertyvalue
- the value to storepublic static void setBoolean(Properties prop, String key, boolean value)
prop
- The Properties setkey
- the key used to store this propertyvalue
- the value to storepublic static int getInteger(Properties prop, String key) throws NumberFormatException
prop
- The Properties setkey
- the key used to store this propertyNumberFormatException
- if the property retrieved cannot be
converted to int
public static int getInteger(Properties prop, String key, int def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static int touchInteger(Properties prop, String key, int defaultValue)
public static void setInteger(Properties prop, String key, int i)
prop
- The Properties setkey
- the key used to store this propertyi
- the value to storepublic static void setInteger(Properties prop, String key, Integer value)
prop
- The Properties setkey
- The key used to store this propertyi
- The value to store (if null, the property with the specified key is removed).public static long getLong(Properties prop, String key, long def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static long touchLong(Properties prop, String key, long defaultValue)
public static void setLong(Properties prop, String key, long i)
prop
- The Properties setkey
- the key used to store this propertyi
- the value to storepublic static void setLong(Properties prop, String key, Long value)
prop
- The Properties setkey
- The key used to store this propertyi
- The value to store (if null, the property with the specified key is removed).public static float getFloat(Properties prop, String key, float def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static float touchFloat(Properties prop, String key, float defaultValue)
public static void setFloat(Properties prop, String key, float f)
prop
- The Properties setkey
- the key used to store this propertyf
- the value to storepublic static void setFloat(Properties prop, String key, Float value)
prop
- The Properties setkey
- The key used to store this propertyi
- The value to store (if null, the property with the specified key is removed).public static double getDouble(Properties prop, String key, double def)
prop
- The Properties setkey
- the key used to store this propertydef
- a default in case the property cannot be retrievedpublic static double touchDouble(Properties prop, String key, double defaultValue)
public static void setDouble(Properties prop, String key, double f)
prop
- The Properties setkey
- the key used to store this propertyf
- the value to storepublic static void setDouble(Properties prop, String key, Double value)
prop
- The Properties setkey
- The key used to store this propertyi
- The value to store (if null, the property with the specified key is removed).public static URL getURL(Properties prop, String key, URL def)
public static URL touchURL(Properties prop, String key, URL defaultValue)
public static void setURL(Properties prop, String key, URL url)
public static String translate(Properties prop, String in)
prop
- The properties setin
- The string to be translatedCopyright © 2000–2015 FreeHEP. All rights reserved.