|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcsli.util.Config
public class Config
| Field Summary | |
|---|---|
static Config |
main
Main config file for the application. |
| Method Summary | |
|---|---|
String |
get(String key)
Returns the config property, null if it doesn't exist. |
File |
getAbsoluteFile(String value)
Returns a file assuming that it is specified as an absolute path. |
List<File> |
getAbsoluteFileList(String key)
Assumes the key's value is a list of file paths, or a file containing such a list (see getList(String))
and returns them as a list of Files. |
File |
getAbsoluteFileProperty(String key)
This returns a File object as described by the specified key, which must be an absolute path. |
boolean |
getBoolean(String key)
If the value of the key is true, return true, otherwise return false; |
List<Boolean> |
getBooleanList(String key)
Returns a list of Booleans corresponding to the key, which is specified either as a filename, or comma delimited, in square brackets. |
static Config |
getConfig(String filename)
Returns the config object for the specified filename. |
static String |
getConfigDir()
|
Properties |
getConfigProperties()
|
double |
getDouble(String key)
Returns a double corresponding to the key, NaN if none |
List<Double> |
getDoubleList(String key)
Returns a list of Doubles corresponding to the key, which is specified either as a filename, or comma delimited, in square brackets. |
List<File> |
getExistingFileList(String key)
Assumes the key's value is a list of file paths, or a file containing such a list (see getList(String))
and returns them as a list of Files. |
File |
getExistingFileProperty(String key)
This returns a File object as described by the specified key. |
List<File> |
getFileList(String key)
Assumes the key's value is a list of file paths, or a file containing such a list (see getList(String))
and returns them as a list of Files. |
String |
getFilename()
|
File |
getFileProperty(String key)
This returns a File object as described by the specified key, which must be a path relative to the config directory. |
int |
getInteger(String key)
Returns an integer corresponding to the key, -1 if none |
List<Integer> |
getIntegerList(String key)
Returns a list of Integers corresponding to the key, which is specified either as a filename, or comma delimited, in square brackets. |
Collection |
getKeys()
|
List<String> |
getList(String key)
Gets a list, which is specified either as a filename, or comma delimited, in square brackets. |
static Config |
getMainConfig()
|
File |
getRelativeFile(String value)
Returns a file relative to the main config dir. |
List<File> |
getRelativeFileList(String key)
Assumes the key's value is a list of file paths, or a file containing such a list (see getList(String))
and returns them as a list of Files. |
Set<String> |
getSet(String key)
Same as getList, only returning a set (each element is unique) See comments for getList. |
void |
save()
Save the config properties |
void |
saveList(String configKey,
List list)
Save the list in the file specified by the config setting. |
void |
set(String key,
String value)
Sets the config property ( and auto-saves the file). |
void |
set(String key,
String value,
boolean save)
|
void |
setBoolean(String key,
boolean b)
|
void |
setBoolean(String key,
boolean b,
boolean save)
|
static void |
setConfigDir(String path)
|
void |
setInteger(String key,
int i)
|
static void |
setMainConfigFile(String filename)
Sets the main properties file. |
static void |
setMainEmptyConfig()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static Config main
| Method Detail |
|---|
public static Config getConfig(String filename)
filename -
public static String getConfigDir()
public static Config getMainConfig()
public static void setConfigDir(String path)
public static void setMainConfigFile(String filename)
public static void setMainEmptyConfig()
public String get(String key)
public boolean getBoolean(String key)
public List<Boolean> getBooleanList(String key)
key -
public List<File> getFileList(String key)
getList(String))
and returns them as a list of Files. Just calls getList(key) and appropriately converts to file using same helper
as getRelativeFile(String)
key -
public List<File> getRelativeFileList(String key)
getList(String))
and returns them as a list of Files. Just calls getList(key) and appropriately converts to file using same helper
as getRelativeFile(String)
key -
public List<File> getAbsoluteFileList(String key)
getList(String))
and returns them as a list of Files. Just calls getList(key) and appropriately converts to file using same helper
as getAbsoluteFile(String)
key -
public List<File> getExistingFileList(String key)
getList(String))
and returns them as a list of Files. Just calls getList(key) and converts to file using same method as
getExistingFileProperty(String) - each value is first treated as a path relative to the config
directory; if the file doesn't exist, it is treated as an absolute path; if it still doesn't exist, we return
null.
key -
public String getFilename()
public File getFileProperty(String key)
public File getAbsoluteFileProperty(String key)
public File getExistingFileProperty(String key)
key - the config key
public int getInteger(String key)
key -
public List<Integer> getIntegerList(String key)
key -
public double getDouble(String key)
key -
public List<Double> getDoubleList(String key)
key -
public Collection getKeys()
public List<String> getList(String key)
public File getRelativeFile(String value)
relativePath -
public File getAbsoluteFile(String value)
absolutePath -
public Set<String> getSet(String key)
public void save()
public void saveList(String configKey,
List list)
configKey - el -
public void set(String key,
String value)
public void set(String key,
String value,
boolean save)
public void setBoolean(String key,
boolean b)
public void setBoolean(String key,
boolean b,
boolean save)
public void setInteger(String key,
int i)
public Properties getConfigProperties()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||