Class Properties
- All Implemented Interfaces:
Serializable,Map<String,List<String>>
- Direct Known Subclasses:
QueryString
This class is a enhanced version of Properties
that enforces the use of String keys and values internally, but offers many
convenience methods for storing and retrieving multiple values of different
types (e.g. Integer, Locale, File, etc). It also supports properties with
multiple values. You can also see this class as a
string-based multi-value map with helpful methods. While it does not extend
Properties, it offers similar load and store
methods and can be used as a replacement for it in many cases. It also
adds support for storing/loading as JSON, XML, and Java Bean.
This class extends ObservableMap which means you can listen
for property changes.
To insert values, there are set and add methods.
The set methods will first remove any existing value(s) under the
given key before inserting the new one(s).
It is essentially the same behavior as
Map.put(Object, Object). The add method will add the
new value(s) to the list of already existing ones (if any).
The storing of entries with multiple values will create one file entry per value. To preserve old behavior and force multiple values to be on the same line, use the store/load method accepting a joining delimiter.
Upon encountering a problem in parsing a value to
its desired type, a PropertiesException is thrown.
- Author:
- Pascal Essiembre
- See Also:
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance with case-sensitive keys.Properties(boolean caseInsensitiveKeys) Creates a new instance.Properties(Map<String, List<String>> map) DecoratesMapas aProperties.Properties(Map<String, List<String>> map, boolean caseInsensitiveKeys) Decorates aMapargument as aProperties. -
Method Summary
Modifier and TypeMethodDescriptionfinal <T> voidAdds one or multiple string values.final voidaddBigDecimal(String key, BigDecimal... values) Deprecated.final voidaddBoolean(String key, boolean... values) Deprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final <T> voidAdds one or multiple values as strings.final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)final voidDeprecated.Since 2.0.0, useadd(String, Object...)booleanvoidfromString(String str) Reads a property list (key and element pairs) from the input string.final <T> TGets a single value, converted to the given type.final <T> TGets a single value, converted to the given type.final BigDecimalgetBigDecimal(String key) Gets value as a BigDecimal.final BigDecimalgetBigDecimal(String key, BigDecimal defaultValue) Gets value as a BigDecimal.final List<BigDecimal>getBigDecimals(String key) Gets values as a list of BigDecimals.final BooleangetBoolean(String key) Gets value as a boolean.final BooleangetBoolean(String key, Boolean defaultValue) Gets value as a boolean.getBooleans(String key) Gets values as a list of booleans.final Class<?>Gets a class, assuming key value is a fully qualified class name available in the classloader.final Class<?>Gets a class, assuming key value is a fully qualified class name available in the classloader.getClasses(String key) Gets values as a list of initialized classes.final DateGets value as a date.final DateGets value as a date.Gets values as a list of dates.final DoubleGets value as a double.final DoubleGets value as a double.getDoubles(String key) Gets values as a list of doubles.final FileGets a file, assuming key value is a file system path.final FileGets a file, assuming key value is a file system path.Gets values as a list of files.final FloatGets value as a float.final FloatGets value as a float.Gets values as a list of floats.final InstantgetInstant(String key) Gets value as a UTC date-timeInstant.final InstantgetInstant(String key, Instant defaultValue) Gets value as a UTC date-timeInstant.getInstants(String key) Gets values as a list of UTC date-timeInstants.final IntegergetInteger(String key) Gets value as an integer.final IntegergetInteger(String key, Integer defaultValue) Gets value as an integer.getIntegers(String key) Gets values as a list of integers.final <T> List<T>Gets a list of values, with its elements converted to the given type.final <T> List<T>Gets a list of values, with its elements converted to the given type.final LocalDateTimegetLocalDateTime(String key) Gets value as a local date-time.final LocalDateTimegetLocalDateTime(String key, LocalDateTime defaultValue) Gets value as a local date-time.final List<LocalDateTime>getLocalDateTimes(String key) Gets values as a list of local date-times.final LocaleGets value as a locale.final LocaleGets value as a locale.getLocales(String key) Gets values as a list of locales.final LongGets value as a long.final LongGets value as a long.Gets values as a list of longs.final StringGets value as string.final StringGets value as string.getStrings(String key) Gets values as a list of strings.inthashCode()booleanGets whether keys are case sensitive or not.voidload(InputStream inStream) Deprecated.Since 2.0.0, useloadFromProperties(...)voidload(InputStream inStream, String encoding) Deprecated.Since 2.0.0, useloadFromProperties(...)voidload(InputStream inStream, String encoding, String delimiter) Deprecated.Since 2.0.0, useloadFromProperties(...)voidDeprecated.Since 2.0.0, useloadFromProperties(...)voidDeprecated.Since 2.0.0, useloadFromProperties(...)voidloadFromBean(Object bean) Converts all the bean properties into entries in this instance.voidLoads all of the properties from the JSON document input stream (UTF-8) into this instance.voidloadFromJSON(Reader reader) Loads all of the properties from the JSON document reader into this instance.voidloadFromMap(Map<?, ?> map) Reads all key/value pairs in the given map, and add them to thisMap.voidloadFromProperties(InputStream inStream) Loads thisMapfrom an input of a format compatible withProperties.load(InputStream).voidloadFromProperties(InputStream inStream, String delimiter) Loads thisMapfrom an input of a format compatible withProperties.load(InputStream).voidloadFromProperties(Reader reader) Loads thisMapfrom an input of a format compatible withProperties.load(Reader).voidloadFromProperties(Reader reader, String delimiter) Loads thisMapfrom an input of a format compatible withProperties.load(Reader).voidLoads thisMapfrom an input of a format compatible withProperties.loadFromXML(InputStream).voidloadFromXML(InputStream in, String delimiter) Loads thisMapfrom an input of a format compatible withProperties.load(InputStream).voidloadFromXML(Reader reader) Loads thisMapfrom an input of a format compatible withProperties.loadFromXML(InputStream).voidloadFromXML(Reader reader, String delimiter) Loads thisMapfrom an input of a format compatible withProperties.load(InputStream).match(PropertyMatcher propertyMatcher) Gets a properties subset for keys and values matched by the property matcher.match(TextMatcher fieldMatcher, TextMatcher valueMatcher) Gets a properties subset for matching keys and values.matchKeys(TextMatcher keyMatcher) Gets a properties subset for keys matched by the key matcher.matchValues(TextMatcher valueMatcher) Gets a properties subset for values matched by the value matcher.voidfinal <T> voidSets one or multiple values as strings replacing existing ones.final voidsetBigDecimal(String key, BigDecimal... values) Deprecated.Since 2.0.0, useset(String, Object...)final voidsetBoolean(String key, boolean... values) Deprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final <T> voidSets one or multiple values as strings replacing existing ones.final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)final voidDeprecated.Since 2.0.0, useset(String, Object...)voidstore(OutputStream out) Deprecated.Since 2.0.0, usestoreToProperties(...)voidstore(OutputStream out, String comments) Deprecated.Since 2.0.0, usestoreToProperties(...)voidstore(OutputStream out, String comments, String delimiter) Deprecated.Since 2.0.0, usestoreToProperties(...)voidDeprecated.Since 2.0.0, usestoreToProperties(...)voidDeprecated.Since 2.0.0, usestoreToProperties(...)voidDeprecated.Since 2.0.0, usestoreToProperties(...)voidstoreToBean(Object bean) Copy all properties in this map to the given bean, mapping keys to setter methods of the same name.voidWrites thisMapas JSON to the output stream as UTF-8 in a format suitable for using theloadFromJSON(InputStream)method.voidstoreToJSON(Writer writer) Writes thisMapas JSON to the writer in a format suitable for using theloadFromJSON(Reader)method.voidStores thisMapin a format compatible withProperties.store(OutputStream, String).voidstoreToProperties(OutputStream out, String delimiter) Stores thisMapin a format compatible withProperties.store(OutputStream, String).voidstoreToProperties(Writer writer) Stores thisMapin a format compatible withProperties.store(Writer, String).voidstoreToProperties(Writer writer, String delimiter) Stores thisMapin a format compatible withProperties.store(Writer, String).voidStores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String).voidstoreToXML(OutputStream os, String delimiter) Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String).voidstoreToXML(Writer writer) Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String).voidstoreToXML(Writer writer, String delimiter) Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String).Converts thisMapto a new JavaPropertiesinstance.toString()Returns thisMapin a format compatible withProperties.store(Writer, String).Returns all property values merged into a single list.Methods inherited from class com.norconex.commons.lang.map.ObservableMap
addMapChangeListener, clear, containsKey, containsValue, entrySet, isEmpty, keySet, removeMapChangeListener, size, valuesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
DEFAULT_JAVA_PROPERTIES_DELIMITER
- See Also:
-
-
Constructor Details
-
Properties
public Properties()Create a new instance with case-sensitive keys. Internally wraps aHashMapto store keys and values. -
Properties
public Properties(boolean caseInsensitiveKeys) Creates a new instance. Internally wraps aHashMapto store keys and values.- Parameters:
caseInsensitiveKeys- whentruemethods taking a key argument will consider the key being passed without consideration for character case.
-
Properties
DecoratesMapas aProperties. As of version 1.4 theMapargument is decorated so that modifications to this instance will also modify the suppliedMap. To use aMapto initialize values only, use theloadFromMap(Map)method.- Parameters:
map- the Map to decorate
-
Properties
Decorates aMapargument as aProperties. As of version 1.4 theMapargument is decorated so that modifications to this instance will also modify the suppliedMap. To use aMapto initialize values only, use theloadFromMap(Map)method.- Parameters:
map- the Map to decoratecaseInsensitiveKeys- whentruemethods taking a key argument will consider the key being passed without consideration for character case.
-
-
Method Details
-
isCaseInsensitiveKeys
public boolean isCaseInsensitiveKeys()Gets whether keys are case sensitive or not.- Returns:
trueif case insensitive- Since:
- 1.8
-
matchKeys
Gets a properties subset for keys matched by the key matcher.- Parameters:
keyMatcher- keys to match- Returns:
- properties subset or empty properties (never
null) - Since:
- 2.0.0
-
matchValues
Gets a properties subset for values matched by the value matcher.- Parameters:
valueMatcher- values to match- Returns:
- properties subset or empty properties (never
null) - Since:
- 2.0.0
-
match
Gets a properties subset for keys and values matched by the property matcher. Same as invokingmatch(TextMatcher, TextMatcher).- Parameters:
propertyMatcher- property matcher- Returns:
- properties subset or empty properties (never
null) - Since:
- 2.0.0
-
match
Gets a properties subset for matching keys and values. Same as invokingmatch(PropertyMatcher).- Parameters:
fieldMatcher- property matchervalueMatcher- property value- Returns:
- properties subset or empty properties (never
null) - Since:
- 2.0.0
-
toString
Returns thisMapin a format compatible withProperties.store(Writer, String). Multi-value properties are merged, joined by the symbol for record separator (U+241E).- Overrides:
toStringin classObservableMap<String,List<String>> - Returns:
- the properties as string
- Since:
- 2.0.0
-
storeToProperties
Stores thisMapin a format compatible withProperties.store(Writer, String). Multi-value properties are merged, joined by the symbol for record separator (U+241E).- Parameters:
writer- an output character stream writer.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
storeToProperties
Stores thisMapin a format compatible withProperties.store(Writer, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
writer- an output character stream writer.delimiter- string to used as a separator when joining multiple values for the same key.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
storeToProperties
Stores thisMapin a format compatible withProperties.store(OutputStream, String). Multi-value properties are merged, joined by the symbol for record separator (U+241E).- Parameters:
out- an output stream.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
storeToProperties
Stores thisMapin a format compatible withProperties.store(OutputStream, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
out- an output stream.delimiter- delimiter string to used as a separator when joining multiple values for the same key.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
storeToXML
Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String). Multi-value properties are merged, joined by the symbol for record separator (U+241E).- Parameters:
os- the output stream on which to store the XML document.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
storeToXML
Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
os- the output stream on which to store the XML document.delimiter- delimiter string to used as a separator when joining multiple values for the same key.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
storeToXML
Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String). Multi-value properties are merged, joined by the symbol for record separator (U+241E).- Parameters:
writer- writer on which to store the XML document.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
storeToXML
Stores thisMapin a UTF-8 format compatible withProperties.storeToXML(OutputStream, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
writer- the writer on which to store the XML document.delimiter- delimiter string to used as a separator when joining multiple values for the same key.- Throws:
IOException- i/o problem
-
storeToJSON
Writes thisMapas JSON to the output stream as UTF-8 in a format suitable for using theloadFromJSON(InputStream)method.- Parameters:
os- the output stream on which to store the properties.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
storeToJSON
Writes thisMapas JSON to the writer in a format suitable for using theloadFromJSON(Reader)method.- Parameters:
writer- the writer on which to store the XML document.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
storeToBean
Copy all properties in this map to the given bean, mapping keys to setter methods of the same name. Existing bean values for matching accessors are overwritten. Other values are left intact.nullbeans are ignored.- Parameters:
bean- the object to store properties into- Since:
- 2.0.0
-
fromString
Reads a property list (key and element pairs) from the input string. Otherwise, the same considerations asloadFromProperties(InputStream)apply.- Parameters:
str- the string to load
-
toProperties
Converts thisMapto a new JavaPropertiesinstance. Multi-value properties are merged, joined by the symbol for record separator (U+241E).- Returns:
- a
java.util.Propertiesinstance - Since:
- 2.0.0
- See Also:
-
loadFromMap
Reads all key/value pairs in the given map, and add them to this
Map. Keys and values are converted to strings using their toString() method, with exception of values being arrays or collections. In such case, the entry is considered a multi-value one and each value will be converted to individual strings.nullkeys are ignored.nullvalues are converted to an empty string.Changes to this instance won't be reflected in the given
Map. If you want otherwise, use invoke the constructor with aMapargument.You can use this method to populate this
Mapfrom aProperties.- Parameters:
map- the map containing values to load- Since:
- 2.0.0
-
loadFromProperties
Loads thisMapfrom an input of a format compatible withProperties.load(Reader). Multi-value properties are split using the symbol for record separator (U+241E).- Parameters:
reader- the input character stream.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
loadFromProperties
Loads thisMapfrom an input of a format compatible withProperties.load(Reader). Multi-value properties are split using the supplied delimiter string. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
reader- the input character stream.delimiter- delimiter string to used to parse a multi-value key.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
loadFromProperties
Loads thisMapfrom an input of a format compatible withProperties.load(InputStream). Multi-value properties are split using the symbol for record separator (U+241E).- Parameters:
inStream- the input stream.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
loadFromProperties
Loads thisMapfrom an input of a format compatible withProperties.load(InputStream). Multi-value properties are split using the supplied delimiter string. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
inStream- the input stream.delimiter- delimiter string to used to parse a multi value key.- Throws:
IOException- i/o problem- Since:
- 2.0.0
-
loadFromXML
Loads thisMapfrom an input of a format compatible withProperties.loadFromXML(InputStream). Multi-value properties are split using the symbol for record separator (U+241E).- Parameters:
in- in the input stream from which to read the XML document.- Throws:
IOException- i/o problem
-
loadFromXML
Loads thisMapfrom an input of a format compatible withProperties.load(InputStream). Multi-value properties are split using the supplied delimiter string. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
in- in the input stream from which to read the XML document.delimiter- delimiter string to used to parse a multi-value key.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
loadFromXML
Loads thisMapfrom an input of a format compatible withProperties.loadFromXML(InputStream). Multi-value properties are split using the symbol for record separator (U+241E).- Parameters:
reader- the reader from which to read the XML document.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
loadFromXML
Loads thisMapfrom an input of a format compatible withProperties.load(InputStream). Multi-value properties are split using the supplied delimiter string. If the delimiter isnull, the symbol for record separator (U+241E) is used.- Parameters:
reader- reader from which to read the XML document.delimiter- delimiter string to used to parse a multi-value key.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
loadFromJSON
Loads all of the properties from the JSON document input stream (UTF-8) into this instance.- Parameters:
in- the input stream from which to read the JSON document.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
loadFromJSON
Loads all of the properties from the JSON document reader into this instance.- Parameters:
reader- the reader from which to read the JSON document.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
loadFromBean
Converts all the bean properties into entries in this instance.nullbeans are ignored.- Parameters:
bean- the object to load properties from- Since:
- 2.0.0
-
get
Gets a single value, converted to the given type.- Type Parameters:
T- returned value type- Parameters:
key- the key of the value to gettype- target class of value- Returns:
- value
- Since:
- 2.0.0
-
get
Gets a single value, converted to the given type.- Type Parameters:
T- returned value type- Parameters:
key- the key of the value to gettype- target class of valuedefaultValue- default value if key has no value.- Returns:
- value
- Since:
- 2.0.0
-
getList
Gets a list of values, with its elements converted to the given type.- Type Parameters:
T- returned list type- Parameters:
key- the key of the values to gettype- target class of values- Returns:
- value list
- Since:
- 2.0.0
-
getList
Gets a list of values, with its elements converted to the given type.- Type Parameters:
T- returned list type- Parameters:
key- the key of the values to gettype- target class of valuesdefaultValues- default values if the key returnsnullor an empty list- Returns:
- value list
- Since:
- 2.0.0
-
set
Sets one or multiple values as strings replacing existing ones. Setting a singlenullvalue or an empty array is the same as callingremove(Object)with the same key. When setting multiple values,nullvalues are converted to empty strings.- Type Parameters:
T- values type- Parameters:
key- the key of the value to setvalues- the values to set- Since:
- 2.0.0
-
add
Adds one or multiple string values. Adding a singlenullvalue has no effect. When adding multiple values,nullvalues are converted to blank strings.- Type Parameters:
T- values type- Parameters:
key- the key of the value to setvalues- the values to set- Since:
- 2.0.0
-
setList
Sets one or multiple values as strings replacing existing ones. Setting a singlenullvalue or an empty array is the same as callingremove(Object)with the same key. When setting multiple values,nullvalues are converted to empty strings.- Type Parameters:
T- values type- Parameters:
key- the key of the value to setvalues- the values to set- Since:
- 2.0.0
-
addList
Adds one or multiple values as strings. Adding anulllist has no effect. When adding multiple values,nullvalues are converted to empty strings.- Type Parameters:
T- values type- Parameters:
key- the key of the value to setvalues- the values to set- Since:
- 2.0.0
-
getString
Gets value as string.- Parameters:
key- property key- Returns:
- the value
-
getString
Gets value as string.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getStrings
Gets values as a list of strings. This method is null-safe. No matches returns an empty list.- Parameters:
key- property key- Returns:
- the values
-
setString
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple string values replacing existing ones. Setting a singlenullvalue or an empty string array is the same as callingremove(Object)with the same key. When setting multiple values,nullvalues are converted to blank strings.- Parameters:
key- the key of the value to setvalues- the values to set
-
addString
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple string values. Adding a singlenullvalue has no effect. When adding multiple values,nullvalues are converted to blank strings.- Parameters:
key- the key of the value to setvalues- the values to set
-
getInteger
Gets value as an integer.- Parameters:
key- property key- Returns:
- the value
-
getInteger
Gets value as an integer.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getIntegers
Gets values as a list of integers.- Parameters:
key- property key- Returns:
- the values
-
setInt
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple integer values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addInt
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple integer values values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getDouble
Gets value as a double.- Parameters:
key- property key- Returns:
- the value
-
getDouble
Gets value as a double.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getDoubles
Gets values as a list of doubles.- Parameters:
key- property key- Returns:
- the values
-
setDouble
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple double values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addDouble
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple double values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getLong
Gets value as a long.- Parameters:
key- property key- Returns:
- the value
-
getLong
Gets value as a long.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getLongs
Gets values as a list of longs.- Parameters:
key- property key- Returns:
- the values
-
setLong
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple long values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addLong
Deprecated.Since 2.0.0, useadd(String, Object...)Add one or multiple long values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getFloat
Gets value as a float.- Parameters:
key- property key- Returns:
- the value
-
getFloat
Gets value as a float.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getFloats
Gets values as a list of floats.- Parameters:
key- property key- Returns:
- the values
-
setFloat
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple float values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addFloat
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple long values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getBigDecimal
Gets value as a BigDecimal.- Parameters:
key- property key- Returns:
- the value
-
getBigDecimal
Gets value as a BigDecimal.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getBigDecimals
Gets values as a list of BigDecimals.- Parameters:
key- property key- Returns:
- the values
-
setBigDecimal
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple BigDecimal values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addBigDecimal
Deprecated.Since 2.0.0, useadd(String, Object...)Add one or multiple BigDecimal values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getLocalDateTime
Gets value as a local date-time. The date must be a valid date-time as defined byDateTimeFormatter.ISO_LOCAL_DATE_TIME.- Parameters:
key- property key- Returns:
- the value
- Since:
- 2.0.0
-
getLocalDateTime
Gets value as a local date-time. The date must be a valid date-time as defined byDateTimeFormatter.ISO_LOCAL_DATE_TIME.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
- Since:
- 2.0.0
-
getLocalDateTimes
Gets values as a list of local date-times. Each date must be a valid date-time as defined byDateTimeFormatter.ISO_LOCAL_DATE_TIME.- Parameters:
key- property key- Returns:
- the values
- Since:
- 2.0.0
-
getInstant
Gets value as a UTC date-timeInstant. The date must be a valid date-time as defined byDateTimeFormatter.ISO_INSTANT.- Parameters:
key- property key- Returns:
- the value
- Since:
- 2.0.0
-
getInstant
Gets value as a UTC date-timeInstant. The date must be a valid date-time as defined byDateTimeFormatter.ISO_INSTANT.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
- Since:
- 2.0.0
-
getInstants
Gets values as a list of UTC date-timeInstants. Each date must be a valid date-time as defined byDateTimeFormatter.ISO_INSTANT.- Parameters:
key- property key- Returns:
- the values
- Since:
- 2.0.0
-
getDate
Gets value as a date.- Parameters:
key- property key- Returns:
- the value
-
getDate
Gets value as a date.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getDates
Gets values as a list of dates.- Parameters:
key- property key- Returns:
- the values
-
setDate
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple date values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addDate
Deprecated.Since 2.0.0, useadd(String, Object...)Add one or multiple date values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getBoolean
Gets value as a boolean. The underlying string value matching the key must exist and equal "true" (ignoring case) to returntrue. Any other value (includingnull) will returnfalse.- Parameters:
key- property key- Returns:
- the value
-
getBoolean
Gets value as a boolean. The underlying string value matching the key must exist and equal "true" (ignoring case) to returntrue. Any other value (includingnull) will returnfalse. If there are no entries for the given key, the default value is returned instead.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getBooleans
Gets values as a list of booleans.- Parameters:
key- property key- Returns:
- the values
-
setBoolean
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple boolean values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addBoolean
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple boolean values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getLocale
Gets value as a locale.- Parameters:
key- property key- Returns:
- the value
-
getLocale
Gets value as a locale.- Parameters:
key- property keydefaultValue- default value to return when original value is null.- Returns:
- the value
-
getLocales
Gets values as a list of locales.- Parameters:
key- property key- Returns:
- the values
-
setLocale
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple locale values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addLocale
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple locale values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getFile
Gets a file, assuming key value is a file system path.- Parameters:
key- properties key- Returns:
- a File
-
getFile
Gets a file, assuming key value is a file system path.- Parameters:
key- properties keydefaultValue- default file being returned if no file has been defined for the given key in the properties.- Returns:
- a File
-
getFiles
Gets values as a list of files.- Parameters:
key- property key- Returns:
- the values
-
setFile
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple file values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addFile
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple file values.- Parameters:
key- the key of the values to setvalues- the values to set
-
getClass
Gets a class, assuming key value is a fully qualified class name available in the classloader.- Parameters:
key- properties key- Returns:
- initialized class
-
getClass
Gets a class, assuming key value is a fully qualified class name available in the classloader.- Parameters:
key- properties keydefaultValue- default file being returned if no class has been defined for the given key in the properties.- Returns:
- initialized class
-
getClasses
Gets values as a list of initialized classes.- Parameters:
key- property key- Returns:
- the values
-
setClass
Deprecated.Since 2.0.0, useset(String, Object...)Sets one or multiple class values, replacing existing ones.- Parameters:
key- the key of the values to setvalues- the values to set
-
addClass
Deprecated.Since 2.0.0, useadd(String, Object...)Adds one or multiple class values.- Parameters:
key- the key of the values to setvalues- the values to set
-
get
-
remove
-
put
-
putAll
-
valueList
Returns all property values merged into a single list. Duplicate values are kept.- Returns:
- value list (never
null) - Since:
- 2.0.0
-
load
Deprecated.Since 2.0.0, useloadFromProperties(...)Deprecated.- Parameters:
reader- the input character stream.- Throws:
IOException- i/o problem
-
load
Deprecated.Since 2.0.0, useloadFromProperties(...)Deprecated.- Parameters:
reader- the input character stream.delimiter- delimiter string to used to parse a multi-value key.- Throws:
IOException- i/o problem- See Also:
-
load
Deprecated.Since 2.0.0, useloadFromProperties(...)Deprecated.- Parameters:
inStream- the input stream.- Throws:
IOException- i/o problem- See Also:
-
load
Deprecated.Since 2.0.0, useloadFromProperties(...)Deprecated.- Parameters:
inStream- the input stream.encoding- delimiter string to used to parse a multi-value key.- Throws:
IOException- i/o problem- See Also:
-
load
@Deprecated public void load(InputStream inStream, String encoding, String delimiter) throws IOException Deprecated.Since 2.0.0, useloadFromProperties(...)Deprecated.- Parameters:
inStream- the input stream.encoding- delimiter string to used to parse a multi-value key.delimiter- delimiter string to used to parse a multi value key.- Throws:
IOException- i/o problem- Since:
- 1.14.0
-
store
Deprecated.Since 2.0.0, usestoreToProperties(...)Deprecated.- Parameters:
writer- an output character stream writer.- Throws:
IOException- i/o problem
-
store
Deprecated.Since 2.0.0, usestoreToProperties(...)Deprecated.- Parameters:
writer- an output character stream writer.comments- a description of the property list.- Throws:
IOException- i/o problem
-
store
Deprecated.Since 2.0.0, usestoreToProperties(...)Deprecated.- Parameters:
writer- an output character stream writer.comments- a description of the property list.delimiter- string to used as a separator when joining multiple values for the same key.- Throws:
IOException- i/o problem
-
store
Deprecated.Since 2.0.0, usestoreToProperties(...)Deprecated.- Parameters:
out- an output stream.- Throws:
IOException- i/o problem
-
store
Deprecated.Since 2.0.0, usestoreToProperties(...)Deprecated.- Parameters:
out- an output stream.comments- a description of the property list.- Throws:
IOException- i/o problem
-
store
@Deprecated public void store(OutputStream out, String comments, String delimiter) throws IOException Deprecated.Since 2.0.0, usestoreToProperties(...)Deprecated.- Parameters:
out- an output stream.comments- a description of the property list.delimiter- delimiter string to used as a separator when joining multiple values for the same key.- Throws:
IOException- i/o problem
-
equals
-
hashCode
public int hashCode()
-
add(String, Object...)