public class Config extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PROJECT_PROPS |
static String |
PSL_CONFIG |
static String |
PSL_CONFIG_DEFAULT |
Constructor and Description |
---|
Config() |
Modifier and Type | Method and Description |
---|---|
static void |
addProperty(String key,
Object value)
Add a property to the configuration.
|
static String |
asString() |
static void |
clear()
Remove all properties from the configuration.
|
static void |
clearProperty(String key)
Remove a property from the configuration.
|
static BigDecimal |
getBigDecimal(String key,
BigDecimal defaultValue) |
static BigInteger |
getBigInteger(String key,
BigInteger defaultValue) |
static boolean |
getBoolean(String key,
boolean defaultValue) |
static Boolean |
getBoolean(String key,
Boolean defaultValue) |
static byte |
getByte(String key,
byte defaultValue) |
static Byte |
getByte(String key,
Byte defaultValue) |
static double |
getDouble(String key,
double defaultValue) |
static Double |
getDouble(String key,
Double defaultValue) |
static float |
getFloat(String key,
float defaultValue) |
static Float |
getFloat(String key,
Float defaultValue) |
static int |
getInt(String key,
int defaultValue) |
static Integer |
getInteger(String key,
Integer defaultValue) |
static List<String> |
getList(String key,
List<String> defaultValue) |
static long |
getLong(String key,
long defaultValue) |
static Long |
getLong(String key,
Long defaultValue) |
static Object |
getNewObject(String key,
String defaultValue)
Returns a new instance of the class whose name associated with the given configuration key.
|
static Object |
getProperty(String key)
Get a property from the configuration.
|
static short |
getShort(String key,
short defaultValue) |
static Short |
getShort(String key,
Short defaultValue) |
static String |
getString(String key,
String defaultValue) |
static void |
init()
(Re)create and populate the initial config.
|
static void |
loadResource(InputStream stream,
String resourceName) |
static void |
loadResource(String path) |
static void |
setProperty(String key,
Object value)
Set a property, this will replace any previously set values.
|
public static final String PROJECT_PROPS
public static final String PSL_CONFIG
public static final String PSL_CONFIG_DEFAULT
public static void init()
public static void loadResource(InputStream stream, String resourceName)
public static void loadResource(String path)
public static void addProperty(String key, Object value)
resource.loader = fileis already present in the configuration and you call
addProperty("resource.loader", "classpath")Then you will end up with a List like the following:
["file", "classpath"]
key
- The key to add the property to.value
- The value to add.public static void setProperty(String key, Object value)
key
- the key to remove along with corresponding value.public static void clearProperty(String key)
key
- the key to remove along with corresponding value.public static void clear()
public static Object getProperty(String key)
key
- The configuration keypublic static boolean getBoolean(String key, boolean defaultValue)
public static byte getByte(String key, byte defaultValue)
public static double getDouble(String key, double defaultValue)
public static float getFloat(String key, float defaultValue)
public static int getInt(String key, int defaultValue)
public static long getLong(String key, long defaultValue)
public static short getShort(String key, short defaultValue)
public static BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
public static BigInteger getBigInteger(String key, BigInteger defaultValue)
public static Object getNewObject(String key, String defaultValue)
public static String asString()
Copyright © 2018 University of California, Santa Cruz. All rights reserved.