|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gjt.universe.Config
Field Summary | |
private static char |
CNUL
|
static java.lang.String |
CONFIG_HEADER
|
static java.lang.String |
DEFAULT_FILE_NAME
|
private static java.io.File |
file
|
private static java.util.Properties |
prop
|
private static java.lang.String |
SNUL
|
Constructor Summary | |
private |
Config()
|
Method Summary | |
static boolean |
getBoolean(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Searches for the value with the specified key in the Config file. |
static java.awt.Color |
getColor(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static java.awt.Color |
getColor(java.lang.String key,
java.awt.Color defaultValue)
Searches for the value with the specified key in the Config file. |
static double |
getDouble(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static double |
getDouble(java.lang.String key,
double defaultValue)
Searches for the value with the specified key in the Config file. |
static java.io.File |
getFile(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static java.io.File |
getFile(java.lang.String key,
java.io.File defaultValue)
Searches for the value with the specified key in the Config file. |
static float |
getFloat(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static float |
getFloat(java.lang.String key,
float defaultValue)
Searches for the value with the specified key in the Config file. |
static float[] |
getFloatArray(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static float[] |
getFloatArray(java.lang.String key,
float[] defaultValue)
Searches for the value with the specified key in the Config file. |
static int |
getInt(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static int |
getInt(java.lang.String key,
int defaultValue)
Searches for the value with the specified key in the Config file. |
static int[] |
getIntArray(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static int[] |
getIntArray(java.lang.String key,
int[] defaultValue)
Searches for the value with the specified key in the Config file. |
static long |
getLong(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static long |
getLong(java.lang.String key,
long defaultValue)
Searches for the value with the specified key in the Config file. |
private static java.lang.String |
getProperty(java.lang.String key)
Ensures keys are case-consistant when written. |
static java.lang.String |
getString(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Searches for the value with the specified key in the Config file. |
static java.lang.String[] |
getStringArray(java.lang.String key)
Searches for the value with the specified key in the Config file. |
static java.lang.String[] |
getStringArray(java.lang.String key,
java.lang.String[] defaultValue)
Searches for the value with the specified key in the Config file. |
private static java.io.File |
getUserFile()
The predefined location of the user config file. |
static void |
init()
Initializes the Config singleton and loads all keys from the user/default configuration files into memory. |
static void |
load()
load() Loads all keys from disk, preferentially using the user configuration file before trying the default configuration file. |
private static java.lang.String[] |
parseArray(java.lang.String line)
Helps parse int/float arrays |
static void |
putBoolean(java.lang.String key,
boolean value)
Stores a value into memory. |
static void |
putColor(java.lang.String key,
java.awt.Color value)
Stores a value into memory. |
static void |
putDouble(java.lang.String key,
double value)
Stores a value into memory. |
static void |
putFile(java.lang.String key,
java.io.File value)
Stores a value into memory. |
static void |
putFloat(java.lang.String key,
float value)
Stores a value into memory. |
static void |
putFloatArray(java.lang.String key,
float[] array)
Stores a value into memory. |
static void |
putInt(java.lang.String key,
int value)
Stores a value into memory. |
static void |
putIntArray(java.lang.String key,
int[] array)
Stores a value into memory. |
static void |
putLong(java.lang.String key,
long value)
Stores a value into memory. |
private static void |
putProperty(java.lang.String key,
java.lang.String property)
Ensures keys are case-consistant when written. |
static void |
putString(java.lang.String key,
java.lang.String value)
Stores a value into memory. |
static void |
putStringArray(java.lang.String key,
java.lang.String[] array)
Stores a value into memory. |
private static java.util.Properties |
readDefaultProperties()
Read in default Properties file from .jar file These values will over-ride the default values as specified in get() methods with a default value. |
private static java.util.Properties |
readUserProperties()
Read in user Properties file from disk |
static void |
reset()
Resets user configuration data with default configuration data. |
static void |
save()
Saves all keys to disk. |
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 CONFIG_HEADER
public static final java.lang.String DEFAULT_FILE_NAME
private static final char CNUL
private static final java.lang.String SNUL
private static java.util.Properties prop
private static java.io.File file
Constructor Detail |
private Config()
Method Detail |
public static void init()
public static void load()
public static void save()
public static void reset()
public static void putInt(java.lang.String key, int value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putLong(java.lang.String key, long value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putFloat(java.lang.String key, float value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putDouble(java.lang.String key, double value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putBoolean(java.lang.String key, boolean value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putString(java.lang.String key, java.lang.String value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putColor(java.lang.String key, java.awt.Color value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putFile(java.lang.String key, java.io.File value)
key
- The key for this data itemvalue
- The corresponding value for this keypublic static void putIntArray(java.lang.String key, int[] array)
key
- The key for this data itemarray
- The corresponding value for this keypublic static void putFloatArray(java.lang.String key, float[] array)
key
- The key for this data itemarray
- The corresponding value for this keypublic static void putStringArray(java.lang.String key, java.lang.String[] array)
key
- The key for this data itemarray
- The corresponding value for this keypublic static java.lang.String getString(java.lang.String key)
key
- The key for this data item
public static java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static java.io.File getFile(java.lang.String key)
key
- The key for this data item
public static java.io.File getFile(java.lang.String key, java.io.File defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static java.awt.Color getColor(java.lang.String key)
key
- The key for this data item
public static java.awt.Color getColor(java.lang.String key, java.awt.Color defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static int[] getIntArray(java.lang.String key, int[] defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static float[] getFloatArray(java.lang.String key, float[] defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static int[] getIntArray(java.lang.String key)
key
- The key for this data item
public static float[] getFloatArray(java.lang.String key)
key
- The key for this data item
public static java.lang.String[] getStringArray(java.lang.String key)
key
- The key for this data item
public static boolean getBoolean(java.lang.String key, boolean defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static boolean getBoolean(java.lang.String key)
false
if key could not be found or is of the
incorrect data type.
key
- The key for this data item
public static int getInt(java.lang.String key, int defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static int getInt(java.lang.String key)
key
- The key for this data item
public static long getLong(java.lang.String key, long defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static long getLong(java.lang.String key)
key
- The key for this data item
public static float getFloat(java.lang.String key, float defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static float getFloat(java.lang.String key)
key
- The key for this data item
public static double getDouble(java.lang.String key, double defaultValue)
defaultValue
is returned.
key
- The key for this data itemdefaultValue
- The value to return if key or data is bad
public static double getDouble(java.lang.String key)
key
- The key for this data item
private static void putProperty(java.lang.String key, java.lang.String property)
private static java.lang.String getProperty(java.lang.String key)
private static java.lang.String[] parseArray(java.lang.String line)
private static java.io.File getUserFile()
private static java.util.Properties readUserProperties()
private static java.util.Properties readDefaultProperties()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |