public class PropertyUtils extends Object
Constructor and Description |
---|
PropertyUtils() |
Modifier and Type | Method and Description |
---|---|
void |
checkMetadata(Properties properties,
String key,
String expected)
Check property has the vakue given - throw exception if not.
|
void |
checkOrSetProperty(Properties properties,
String key,
String expected)
Check property is an expected value or set if missing
|
void |
ensurePropertySet(Properties properties,
String key,
String expected)
Set property if not already set.
|
String |
getOrSetDefault(Properties properties,
String key,
String expected)
Get property or the default value - also set the default value if not present
|
static Boolean |
getPropertyAsBoolean(Properties properties,
String key) |
static boolean |
getPropertyAsBoolean(Properties properties,
String key,
boolean dftValue) |
static int |
getPropertyAsInteger(Properties properties,
String key) |
static int |
getPropertyAsInteger(Properties properties,
String key,
int defaultValue) |
static void |
loadFromFile(Properties properties,
String filename) |
static Properties |
loadFromFile(String filename)
Java5 does not have read/write from readers/writers - needed for UTF-8
|
boolean |
propertyEquals(Properties properties,
String key,
String value)
Test whether a property has a value.
|
static void |
storeToFile(Properties properties,
String comment,
String filename) |
public static Properties loadFromFile(String filename) throws IOException
IOException
public static void loadFromFile(Properties properties, String filename) throws IOException
IOException
public static void storeToFile(Properties properties, String comment, String filename) throws IOException
IOException
public static int getPropertyAsInteger(Properties properties, String key)
public static int getPropertyAsInteger(Properties properties, String key, int defaultValue)
public static boolean getPropertyAsBoolean(Properties properties, String key, boolean dftValue)
public static Boolean getPropertyAsBoolean(Properties properties, String key)
public boolean propertyEquals(Properties properties, String key, String value)
public void ensurePropertySet(Properties properties, String key, String expected)
public String getOrSetDefault(Properties properties, String key, String expected)
public void checkOrSetProperty(Properties properties, String key, String expected)
public void checkMetadata(Properties properties, String key, String expected)
Licenced under the Apache License, Version 2.0