public class SimpleConfiguration extends java.lang.Object implements Configuration, java.io.Serializable
Constructor and Description |
---|
SimpleConfiguration() |
SimpleConfiguration(java.util.Properties props) |
SimpleConfiguration(java.lang.String filename) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
get(java.lang.String name) |
java.lang.String |
get(java.lang.String name,
java.lang.String def)
Returns the value of the configuration property named name, or the default value def.
|
java.lang.String[] |
getAll(java.lang.String name) |
boolean |
getBoolean(java.lang.String name) |
boolean |
getBoolean(java.lang.String name,
boolean def) |
boolean[] |
getBooleans(java.lang.String name) |
double |
getDouble(java.lang.String name) |
double |
getDouble(java.lang.String name,
double def) |
double[] |
getDoubles(java.lang.String name) |
int |
getInt(java.lang.String name) |
int |
getInt(java.lang.String name,
int def) |
int[] |
getInts(java.lang.String name) |
long |
getLong(java.lang.String name) |
long |
getLong(java.lang.String name,
long def) |
long[] |
getLongs(java.lang.String name) |
int |
hashCode() |
java.util.Set<java.lang.String> |
keySet() |
void |
load(java.lang.String filename) |
void |
put(java.lang.String name,
java.lang.Object value) |
java.lang.String |
toString() |
public SimpleConfiguration()
public SimpleConfiguration(java.util.Properties props)
public SimpleConfiguration(java.lang.String filename) throws java.io.IOException
java.io.IOException
public java.lang.String get(java.lang.String name, java.lang.String def)
${xxx}
then its value is taken from a system property
if it exists, or an environment variable. System property takes priority over environment variable.
If the format is $sys{...}
we read only a system property.
if the format is $env{...}
only an environment variable is used.get
in interface Configuration
name
- The configuration property key name.def
- The default value.public java.lang.String[] getAll(java.lang.String name)
getAll
in interface Configuration
name
- dittopublic int[] getInts(java.lang.String name)
getInts
in interface Configuration
public long[] getLongs(java.lang.String name)
getLongs
in interface Configuration
public double[] getDoubles(java.lang.String name)
getDoubles
in interface Configuration
public boolean[] getBooleans(java.lang.String name)
getBooleans
in interface Configuration
public java.lang.String get(java.lang.String name)
get
in interface Configuration
public int getInt(java.lang.String name)
getInt
in interface Configuration
public int getInt(java.lang.String name, int def)
getInt
in interface Configuration
public long getLong(java.lang.String name)
getLong
in interface Configuration
public long getLong(java.lang.String name, long def)
getLong
in interface Configuration
public double getDouble(java.lang.String name)
getDouble
in interface Configuration
public double getDouble(java.lang.String name, double def)
getDouble
in interface Configuration
public boolean getBoolean(java.lang.String name)
getBoolean
in interface Configuration
public boolean getBoolean(java.lang.String name, boolean def)
getBoolean
in interface Configuration
public void load(java.lang.String filename) throws java.io.IOException
java.io.IOException
public void put(java.lang.String name, java.lang.Object value)
put
in interface Configuration
name
- the Property namevalue
- typically a String, but could be a String[] toopublic java.util.Set<java.lang.String> keySet()
keySet
in interface Configuration
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object