public class Properties extends org.apache.commons.configuration.PropertiesConfiguration implements Serializable
PropertiesConfiguration
providing setters for primitive types, a simpler way to save preferences
and transparent handling of Enum
lowercased keys.
All accessors defined in PropertiesConfiguration
have a
polymorphic counterpart taking an Enum
instead of a string: Enum.name()
and String.toLowerCase()
are applied before
delegating to the corresponding string-based method. (This apparently wierd choice is due to the need to
accommodate the upper-case standard for Enum
elements and the lower-case standard
for property keys.)
Additionally, instances of this class can be serialised.
org.apache.commons.configuration.PropertiesConfiguration.DefaultIOFactory, org.apache.commons.configuration.PropertiesConfiguration.IOFactory, org.apache.commons.configuration.PropertiesConfiguration.PropertiesReader, org.apache.commons.configuration.PropertiesConfiguration.PropertiesWriter
Constructor and Description |
---|
Properties() |
Properties(File file) |
Properties(String filename) |
Properties(URL url) |
Modifier and Type | Method and Description |
---|---|
void |
addAll(org.apache.commons.configuration.Configuration configuration)
Adds all properties from the given configuration.
|
void |
addProperties(Enum<?> key,
String[] s) |
void |
addProperties(String key,
String[] s) |
void |
addProperty(Enum<?> key,
boolean b) |
void |
addProperty(Enum<?> key,
byte b) |
void |
addProperty(Enum<?> key,
char c) |
void |
addProperty(Enum<?> key,
double d) |
void |
addProperty(Enum<?> key,
float f) |
void |
addProperty(Enum<?> key,
int i) |
void |
addProperty(Enum<?> key,
long l) |
void |
addProperty(Enum<?> key,
Object arg) |
void |
addProperty(Enum<?> key,
short s) |
void |
addProperty(String key,
boolean b) |
void |
addProperty(String key,
byte b) |
void |
addProperty(String key,
char c) |
void |
addProperty(String key,
double d) |
void |
addProperty(String key,
float f) |
void |
addProperty(String key,
int i) |
void |
addProperty(String key,
long l) |
void |
addProperty(String key,
short s) |
boolean |
containsKey(Enum<?> key) |
boolean |
equals(Object o)
Returns true if the provided object is equal to this set of properties.
|
BigDecimal |
getBigDecimal(Enum<?> key) |
BigDecimal |
getBigDecimal(Enum<?> key,
BigDecimal arg) |
BigInteger |
getBigInteger(Enum<?> key) |
BigInteger |
getBigInteger(Enum<?> key,
BigInteger arg) |
boolean |
getBoolean(Enum<?> key) |
boolean |
getBoolean(Enum<?> key,
boolean arg) |
Boolean |
getBoolean(Enum<?> key,
Boolean arg) |
byte |
getByte(Enum<?> key) |
byte |
getByte(Enum<?> key,
byte arg) |
Byte |
getByte(Enum<?> key,
Byte arg) |
double |
getDouble(Enum<?> key) |
double |
getDouble(Enum<?> key,
double arg) |
Double |
getDouble(Enum<?> key,
Double arg) |
float |
getFloat(Enum<?> key) |
float |
getFloat(Enum<?> key,
float arg) |
Float |
getFloat(Enum<?> key,
Float arg) |
int |
getInt(Enum<?> key) |
int |
getInt(Enum<?> key,
int arg) |
Integer |
getInteger(Enum<?> key,
Integer arg) |
Iterator<?> |
getKeys(Enum<?> key) |
List<?> |
getList(Enum<?> key) |
List<?> |
getList(Enum<?> key,
List<?> arg) |
long |
getLong(Enum<?> key) |
long |
getLong(Enum<?> key,
long arg) |
Long |
getLong(Enum<?> key,
Long arg) |
Properties |
getProperties(Enum<?> key) |
Properties |
getProperties(Enum<?> key,
Properties arg) |
Object |
getProperty(Enum<?> key) |
short |
getShort(Enum<?> key) |
short |
getShort(Enum<?> key,
short arg) |
Short |
getShort(Enum<?> key,
Short arg) |
String |
getString(Enum<?> key) |
String |
getString(Enum<?> key,
String arg) |
String[] |
getStringArray(Enum<?> key) |
int |
hashCode() |
void |
save(CharSequence filename)
Saves the configuration to the specified file.
|
void |
setProperty(Enum<?> key,
boolean b) |
void |
setProperty(Enum<?> key,
byte b) |
void |
setProperty(Enum<?> key,
char b) |
void |
setProperty(Enum<?> key,
double d) |
void |
setProperty(Enum<?> key,
float f) |
void |
setProperty(Enum<?> key,
int i) |
void |
setProperty(Enum<?> key,
long l) |
void |
setProperty(Enum<?> key,
Object arg) |
void |
setProperty(Enum<?> key,
short s) |
void |
setProperty(String key,
boolean b) |
void |
setProperty(String key,
byte b) |
void |
setProperty(String key,
char b) |
void |
setProperty(String key,
double d) |
void |
setProperty(String key,
float f) |
void |
setProperty(String key,
int i) |
void |
setProperty(String key,
long l) |
void |
setProperty(String key,
short s) |
org.apache.commons.configuration.Configuration |
subset(Enum<?> key) |
String |
toString() |
clone, createLayout, getEncoding, getFooter, getHeader, getInclude, getIncludesAllowed, getIOFactory, getLayout, isIncludesAllowed, load, save, setBasePath, setFooter, setHeader, setInclude, setIncludesAllowed, setIOFactory, setLayout, unescapeJava
addProperty, clearProperty, closeSilent, configurationChanged, containsKey, enterNoReload, exitNoReload, fireEvent, getBasePath, getFile, getFileName, getFileSystem, getKeys, getPath, getProperty, getReloadingStrategy, getReloadLock, getURL, isAutoSave, isEmpty, load, load, load, load, load, load, possiblySave, refresh, reload, reload, resetFileSystem, save, save, save, save, save, save, setAutoSave, setEncoding, setFile, setFileName, setFileSystem, setPath, setProperty, setReloadingStrategy, setURL
addPropertyDirect, clear, clearPropertyDirect
addErrorLogListener, append, copy, createInterpolator, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDefaultListDelimiter, getDelimiter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getInterpolator, getKeys, getList, getList, getListDelimiter, getLogger, getLong, getLong, getLong, getProperties, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, getSubstitutor, interpolate, interpolate, interpolatedConfiguration, interpolateHelper, isDelimiterParsingDisabled, isScalarValue, isThrowExceptionOnMissing, resolveContainerStore, setDefaultListDelimiter, setDelimiter, setDelimiterParsingDisabled, setListDelimiter, setLogger, setThrowExceptionOnMissing, subset
addConfigurationListener, addErrorListener, clearConfigurationListeners, clearErrorListeners, createErrorEvent, createEvent, fireError, getConfigurationListeners, getErrorListeners, isDetailEvents, removeConfigurationListener, removeErrorListener, setDetailEvents
finalize, getClass, notify, notifyAll, wait, wait, wait
clear, getBigDecimal, getBigDecimal, getBigInteger, getBigInteger, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getShort, getShort, getShort, getString, getString, getStringArray, subset
public Properties()
public Properties(String filename) throws org.apache.commons.configuration.ConfigurationException
org.apache.commons.configuration.ConfigurationException
public Properties(File file) throws org.apache.commons.configuration.ConfigurationException
org.apache.commons.configuration.ConfigurationException
public Properties(URL url) throws org.apache.commons.configuration.ConfigurationException
org.apache.commons.configuration.ConfigurationException
public void save(CharSequence filename) throws org.apache.commons.configuration.ConfigurationException, IOException
filename
- a file name.org.apache.commons.configuration.ConfigurationException
IOException
public void addAll(org.apache.commons.configuration.Configuration configuration)
Properties from the new configuration will clear properties from the first one.
configuration
- a configuration.public void addProperty(String key, boolean b)
public void setProperty(String key, boolean b)
public void addProperty(String key, byte b)
public void setProperty(String key, byte b)
public void addProperty(String key, short s)
public void setProperty(String key, short s)
public void addProperty(String key, char c)
public void setProperty(String key, char b)
public void addProperty(String key, int i)
public void setProperty(String key, int i)
public void addProperty(String key, long l)
public void setProperty(String key, long l)
public void addProperty(String key, float f)
public void setProperty(String key, float f)
public void addProperty(String key, double d)
public void setProperty(String key, double d)
public void addProperty(Enum<?> key, boolean b)
public void setProperty(Enum<?> key, boolean b)
public void addProperty(Enum<?> key, byte b)
public void setProperty(Enum<?> key, byte b)
public void addProperty(Enum<?> key, short s)
public void setProperty(Enum<?> key, short s)
public void addProperty(Enum<?> key, char c)
public void setProperty(Enum<?> key, char b)
public void addProperty(Enum<?> key, int i)
public void setProperty(Enum<?> key, int i)
public void addProperty(Enum<?> key, long l)
public void setProperty(Enum<?> key, long l)
public void addProperty(Enum<?> key, float f)
public void setProperty(Enum<?> key, float f)
public void addProperty(Enum<?> key, double d)
public void setProperty(Enum<?> key, double d)
public boolean containsKey(Enum<?> key)
public BigDecimal getBigDecimal(Enum<?> key, BigDecimal arg)
public BigDecimal getBigDecimal(Enum<?> key)
public BigInteger getBigInteger(Enum<?> key, BigInteger arg)
public BigInteger getBigInteger(Enum<?> key)
public boolean getBoolean(Enum<?> key, boolean arg)
public boolean getBoolean(Enum<?> key)
public byte getByte(Enum<?> key, byte arg)
public byte getByte(Enum<?> key)
public double getDouble(Enum<?> key, double arg)
public double getDouble(Enum<?> key)
public float getFloat(Enum<?> key, float arg)
public float getFloat(Enum<?> key)
public int getInt(Enum<?> key, int arg)
public int getInt(Enum<?> key)
public long getLong(Enum<?> key, long arg)
public long getLong(Enum<?> key)
public Properties getProperties(Enum<?> key, Properties arg)
public Properties getProperties(Enum<?> key)
public short getShort(Enum<?> key, short arg)
public short getShort(Enum<?> key)
public org.apache.commons.configuration.Configuration subset(Enum<?> key)
public boolean equals(Object o)
Equality between set of properties happens when the keys are the same, and the list of strings associated to each key is the same. Note that the order in which different keys appear in a property file is irrelevant, but the order between properties with the same key is significant.
Due to the strictness of the check (e.g., no number conversion is performed) this method is mainly useful when writing tests.
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.