@EqualityReference public final class JProperties extends Object
Properties.| Modifier and Type | Method and Description |
|---|---|
static Properties |
fromFile(File file)
Load properties from the given file.
|
static BigDecimal |
getBigDecimal(Properties properties,
String key)
Returns the real value associated with
key in the properties
referenced by properties. |
static BigDecimal |
getBigDecimalOptional(Properties properties,
String key,
BigDecimal other)
Returns the real value associated with
key in the properties
referenced by properties if it exists, otherwise returns the
given default value. |
static BigInteger |
getBigInteger(Properties properties,
String key)
Returns the integer value associated with
key in the
properties referenced by properties. |
static BigInteger |
getBigIntegerOptional(Properties properties,
String key,
BigInteger other)
Returns the integer value associated with
key in the
properties referenced by properties if it exists, otherwise
returns other. |
static boolean |
getBoolean(Properties properties,
String key)
Returns the boolean value associated with
key in the
properties referenced by properties. |
static boolean |
getBooleanOptional(Properties properties,
String key,
boolean other)
Returns the boolean value associated with
key in the
properties referenced by properties if it exists, otherwise
returns other. |
static String |
getString(Properties properties,
String key)
Returns the string value associated with
key in the
properties referenced by props |
static String |
getStringOptional(Properties properties,
String key,
String other)
Returns the string value associated with
key in the
properties referenced by props if it exists, otherwise
returns other. |
public static Properties fromFile(File file) throws IOException
file - The file.IOException - On I/O errors.public static BigDecimal getBigDecimal(Properties properties, String key) throws JPropertyNonexistent, JPropertyIncorrectType
Returns the real value associated with key in the properties
referenced by properties.
properties - The loaded properties.key - The requested key.JPropertyNonexistent - If the key does not exist in the given properties.JPropertyIncorrectType - If the value associated with the key cannot be parsed as a
real.public static BigDecimal getBigDecimalOptional(Properties properties, String key, BigDecimal other) throws JPropertyNonexistent, JPropertyIncorrectType
Returns the real value associated with key in the properties
referenced by properties if it exists, otherwise returns the
given default value.
other - The default valueproperties - The loaded properties.key - The requested key.JPropertyNonexistent - If the key does not exist in the given properties.JPropertyIncorrectType - If the value associated with the key cannot be parsed as a
real.public static BigInteger getBigInteger(Properties properties, String key) throws JPropertyNonexistent, JPropertyIncorrectType
Returns the integer value associated with key in the
properties referenced by properties.
properties - The loaded properties.key - The requested key.JPropertyNonexistent - If the key does not exist in the given properties.JPropertyIncorrectType - If the value associated with the key cannot be parsed as an
integer.public static BigInteger getBigIntegerOptional(Properties properties, String key, BigInteger other) throws JPropertyNonexistent, JPropertyIncorrectType
Returns the integer value associated with key in the
properties referenced by properties if it exists, otherwise
returns other.
other - The default valueproperties - The loaded properties.key - The requested key.JPropertyNonexistent - If the key does not exist in the given properties.JPropertyIncorrectType - If the value associated with the key cannot be parsed as an
integer.public static boolean getBoolean(Properties properties, String key) throws JPropertyNonexistent, JPropertyIncorrectType
Returns the boolean value associated with key in the
properties referenced by properties.
A boolean value is syntactically the strings "true" or "false", case insensitive.
properties - The loaded properties.key - The requested key.JPropertyNonexistent - If the key does not exist in the given properties.JPropertyIncorrectType - If the value associated with the key cannot be parsed as a
boolean.public static boolean getBooleanOptional(Properties properties, String key, boolean other) throws JPropertyNonexistent, JPropertyIncorrectType
Returns the boolean value associated with key in the
properties referenced by properties if it exists, otherwise
returns other.
A boolean value is syntactically the strings "true" or "false", case insensitive.
other - The default valueproperties - The loaded properties.key - The requested key.JPropertyNonexistent - If the key does not exist in the given properties.JPropertyIncorrectType - If the value associated with the key cannot be parsed as a
boolean.public static String getString(Properties properties, String key) throws JPropertyNonexistent
Returns the string value associated with key in the
properties referenced by props
properties - The loaded properties.key - The requested key.JPropertyNonexistent - If the given key is not present in the given properties.public static String getStringOptional(Properties properties, String key, String other) throws JPropertyNonexistent
Returns the string value associated with key in the
properties referenced by props if it exists, otherwise
returns other.
other - The default valueproperties - The loaded properties.key - The requested key.JPropertyNonexistent - If the given key is not present in the given properties.Copyright © 2017 <code@io7m.com> http://io7m.com