public interface Properties extends Dictionary<String,String>
Properties are a specialization of the Dictionary. As the
name says its on a String pairs key/value collection as properties
usually occur in pure text form to be converted to the required data types.
For this reason, the Properties interface provides additional
conversion methods.| Modifier and Type | Interface and Description |
|---|---|
static interface |
Properties.ClearableProperties |
static interface |
Properties.MutableProperties |
static interface |
Properties.PropertiesBuilder |
Dictionary.ClearableDictionary<K,V>, Dictionary.MutableDictionary<K,V>Keys.ClearableKeys<K,V>, Keys.MutableKeys<K,V>| Modifier and Type | Method and Description |
|---|---|
default Boolean |
getBoolean(String aKey)
Returns the
Boolean value of the property referred to by the key. |
default Byte |
getByte(String aKey)
Returns the
Byte value of the property referred to by the key. |
default Double |
getDouble(String aKey)
Returns the
Double value of the property referred to by the key. |
default Float |
getFloat(String aKey)
Returns the
Float value of the property referred to by the key. |
default Integer |
getInteger(String aKey)
Returns the
Integer value of the property referred to by the key. |
default Long |
getLong(String aKey)
Returns the
Long value of the property referred to by the key. |
default Short |
getShort(String aKey)
Returns the
Short value of the property referred to by the key. |
default void |
saveTo(File aFile)
Saves the properties to the given file.
|
default void |
saveTo(File aFile,
String aComment)
Saves the properties to the given file.
|
default void |
saveTo(String aFilePath)
Saves the properties to the given file.
|
default void |
saveTo(String aFilePath,
String aComment)
Saves the properties to the given file.
|
default Map<String,String> |
toMap()
This method creates a
Map instance from this Properties
instance's elements (key/value-pairs) as of interoperability reasons. |
default Properties |
toProperties()
This method creates a
Properties instance from this
Properties instance's elements (key/value-pairs) as of
interoperability reasons. |
containsKey, get, keySet, valuesisEmpty, sizedefault Integer getInteger(String aKey) throws NumberFormatException
Integer value of the property referred to by the key.
As property keys and values are of type String, the
String value is converted accordingly.aKey - The key for which to retrieve the value.Integer representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Short getShort(String aKey) throws NumberFormatException
Short value of the property referred to by the key.
As property keys and values are of type String, the
String value is converted accordingly.aKey - The key for which to retrieve the value.Short representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Byte getByte(String aKey) throws NumberFormatException
Byte value of the property referred to by the key. As
property keys and values are of type String, the String
value is converted accordingly.aKey - The key for which to retrieve the value.Byte representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Double getDouble(String aKey) throws NumberFormatException
Double value of the property referred to by the key.
As property keys and values are of type String, the
String value is converted accordingly.aKey - The key for which to retrieve the value.Double representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Float getFloat(String aKey) throws NumberFormatException
Float value of the property referred to by the key.
As property keys and values are of type String, the
String value is converted accordingly.aKey - The key for which to retrieve the value.Float representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Boolean getBoolean(String aKey) throws NumberFormatException
Boolean value of the property referred to by the key.
As property keys and values are of type String, the
String value is converted accordingly.aKey - The key for which to retrieve the value.Boolean representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Long getLong(String aKey) throws NumberFormatException
Long value of the property referred to by the key. As
property keys and values are of type String, the String
value is converted accordingly.aKey - The key for which to retrieve the value.Long representation of the key's String
value.NumberFormatException - thrown in case conversion fails.default Properties toProperties()
Properties instance from this
Properties instance's elements (key/value-pairs) as of
interoperability reasons.Properties object from the herein contained
key/value-pairs .default Map<String,String> toMap()
Map instance from this Properties
instance's elements (key/value-pairs) as of interoperability reasons.Map object from the herein contained key/value-pairs .default void saveTo(String aFilePath) throws IOException
Properties.MutableProperties.loadFrom(File)aFilePath - The file path from which to load the properties.IOException - thrown in case saving the properties faileddefault void saveTo(File aFile) throws IOException
Properties.MutableProperties.loadFrom(File)aFile - The File from which to load the properties.IOException - thrown in case saving the properties faileddefault void saveTo(String aFilePath, String aComment) throws IOException
Properties.MutableProperties.loadFrom(File)aFilePath - The file path from which to load the properties.aComment - The description for the properties file.IOException - thrown in case saving the properties faileddefault void saveTo(File aFile, String aComment) throws IOException
Properties.MutableProperties.loadFrom(File)aFile - The File from which to load the properties.aComment - The description for the properties file.IOException - thrown in case saving the properties failedCopyright © 2017. All rights reserved.