public class Properties extends ObservableMap<String,List<String>> implements Serializable
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.
This class extends ObservableMap
which means you can listen
for property changes.
To insert values, there are set methods and add methods.
The set methods will replace any value(s) already present under the
given key. 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).
Since 1.14.0, 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. That version also introduced storing and loading as JSON.
Upon encountering a problem in parsing a value to
its desired type, a PropertiesException
is thrown.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_MULTIVALUE_DELIMITER
Deprecated.
Since 1.14.0 this content is not used. If needed,
pass delimiter in store/load methods supporting it instead.
|
Constructor and Description |
---|
Properties()
Create a new instance with case-sensitive keys.
|
Properties(boolean caseInsensitiveKeys)
Creates a new instance.
|
Properties(Map<String,List<String>> map)
Decorates
Map as a Properties . |
Properties(Map<String,List<String>> map,
boolean caseInsensitiveKeys)
Decorates a
Map argument as a Properties . |
Modifier and Type | Method and Description |
---|---|
void |
addBigDecimal(String key,
BigDecimal... values)
Add one or multiple BigDecimal values.
|
void |
addBoolean(String key,
boolean... values)
Adds one or multiple boolean values.
|
void |
addClass(String key,
Class<?>... values)
Adds one or multiple class values.
|
void |
addDate(String key,
Date... values)
Add one or multiple date values.
|
void |
addDouble(String key,
double... values)
Adds one or multiple double values.
|
void |
addFile(String key,
File... values)
Adds one or multiple file values.
|
void |
addFloat(String key,
float... values)
Adds one or multiple long values.
|
void |
addInt(String key,
int... values)
Adds one or multiple integer values values.
|
void |
addLocale(String key,
Locale... values)
Adds one or multiple locale values.
|
void |
addLong(String key,
long... values)
Add one or multiple long values.
|
void |
addString(String key,
String... values)
Adds one or multiple string values.
|
List<String> |
get(Object key) |
BigDecimal |
getBigDecimal(String key)
Gets value as a BigDecimal.
|
BigDecimal |
getBigDecimal(String key,
BigDecimal defaultValue)
Gets value as a BigDecimal.
|
List<BigDecimal> |
getBigDecimals(String key)
Gets values as a list of BigDecimals.
|
boolean |
getBoolean(String key)
Gets value as a boolean.
|
boolean |
getBoolean(String key,
boolean defaultValue)
Gets value as a boolean.
|
List<Boolean> |
getBooleans(String key)
Gets values as a list of booleans.
|
Class<?> |
getClass(String key)
Gets a class, assuming key value is a fully qualified class name
available in the classloader.
|
Class<?> |
getClass(String key,
Class<?> defaultValue)
Gets a class, assuming key value is a fully qualified class name
available in the classloader.
|
List<Class<?>> |
getClasses(String key)
Gets values as a list of initialized classes.
|
Date |
getDate(String key)
Gets value as a date.
|
Date |
getDate(String key,
Date defaultValue)
Gets value as a date.
|
List<Date> |
getDates(String key)
Gets values as a list of dates.
|
double |
getDouble(String key)
Gets value as a double.
|
double |
getDouble(String key,
double defaultValue)
Gets value as a double.
|
List<Double> |
getDoubles(String key)
Gets values as a list of doubles.
|
File |
getFile(String key)
Gets a file, assuming key value is a file system path.
|
File |
getFile(String key,
File defaultValue)
Gets a file, assuming key value is a file system path.
|
List<File> |
getFiles(String key)
Gets values as a list of files.
|
float |
getFloat(String key)
Gets value as a float.
|
float |
getFloat(String key,
float defaultValue)
Gets value as a float.
|
List<Float> |
getFloats(String key)
Gets values as a list of floats.
|
int |
getInt(String key)
Gets value as an integer.
|
int |
getInt(String key,
int defaultValue)
Gets value as an integer.
|
List<Integer> |
getInts(String key)
Gets values as a list of integers.
|
Locale |
getLocale(String key)
Gets value as a locale.
|
Locale |
getLocale(String key,
Locale defaultValue)
Gets value as a locale.
|
List<Locale> |
getLocales(String key)
Gets values as a list of locales.
|
long |
getLong(String key)
Gets value as a long.
|
long |
getLong(String key,
long defaultValue)
Gets value as a long.
|
List<Long> |
getLongs(String key)
Gets values as a list of longs.
|
String |
getMultiValueDelimiter()
Deprecated.
Since 1.14.0, always returns
null . |
String |
getString(String key)
Gets value as string.
|
String |
getString(String key,
String defaultValue)
Gets value as string.
|
List<String> |
getStrings(String key)
Gets values as a list of strings.
|
boolean |
isCaseInsensitiveKeys()
Gets whether keys are case sensitive or not.
|
void |
load(InputStream inStream)
Reads and creates a property list from the input stream (UTF8),
created by (or having
same format as)
store(OutputStream, String, String) method. |
void |
load(InputStream inStream,
String encoding)
Reads and creates a property list from the input stream,
created by (or having
same format as)
store(OutputStream, String, String) method. |
void |
load(InputStream inStream,
String encoding,
String delimiter)
Reads and creates a property list from the input stream (UTF8),
created by (or having
same format as)
store(OutputStream, String, String) method. |
void |
load(Map<?,?> map)
Reads all key/value pairs in the given map, and
add them to this
Map . |
void |
load(Reader reader)
Reads and creates a property list from the reader, created by (or having
same format as)
store(Writer) method. |
void |
load(Reader reader,
String delimiter)
Reads and creates a property list from the reader, created by (or having
same format as)
store(Writer, String, String) method. |
void |
loadFromJSON(InputStream in)
Loads all of the properties from the JSON document input stream
(UTF-8) into this instance.
|
void |
loadFromJSON(Reader reader)
Loads all of the properties from the JSON document reader
into this instance.
|
void |
loadFromString(String str)
Reads a property list (key and element pairs) from the input
string.
|
void |
loadFromXML(InputStream in)
Loads all of the properties represented by the XML document on the
specified input stream into this instance.
|
void |
loadFromXML(InputStream in,
String encoding)
Loads all of the properties represented by the XML document on the
specified input stream into this instance.
|
void |
loadFromXML(InputStream in,
String encoding,
String delimiter)
Loads all of the properties represented by the XML document on the
specified input stream into this instance.
|
void |
loadFromXML(Reader reader)
Loads all of the properties from the XML document reader
into this instance.
|
void |
loadFromXML(Reader reader,
String delimiter)
Loads all of the properties from the XML document reader
into this instance.
|
List<String> |
put(String key,
List<String> values) |
void |
putAll(Map<? extends String,? extends List<String>> m) |
List<String> |
remove(Object key) |
void |
setBigDecimal(String key,
BigDecimal... values)
Sets one or multiple BigDecimal values, replacing existing ones.
|
void |
setBoolean(String key,
boolean... values)
Sets one or multiple boolean values, replacing existing ones.
|
void |
setClass(String key,
Class<?>... values)
Sets one or multiple class values, replacing existing ones.
|
void |
setDate(String key,
Date... values)
Sets one or multiple date values, replacing existing ones.
|
void |
setDouble(String key,
double... values)
Sets one or multiple double values, replacing existing ones.
|
void |
setFile(String key,
File... values)
Sets one or multiple file values, replacing existing ones.
|
void |
setFloat(String key,
float... values)
Sets one or multiple float values, replacing existing ones.
|
void |
setInt(String key,
int... values)
Sets one or multiple integer values, replacing existing ones.
|
void |
setLocale(String key,
Locale... values)
Sets one or multiple locale values, replacing existing ones.
|
void |
setLong(String key,
long... values)
Sets one or multiple long values, replacing existing ones.
|
void |
setMultiValueDelimiter(String multiValueDelimiter)
Deprecated.
Since 1.14.0, calling this method has no effect.
Pass a delimiter to store/load methods instead if needed.
|
void |
setString(String key,
String... values)
Sets one or multiple string values replacing existing ones.
|
void |
store(OutputStream out)
Writes this
Map (key and element pairs) to the output character
stream as UTF-8 in a format suitable for using the
load(InputStream) method. |
void |
store(OutputStream out,
String comments)
Writes this
Map (key and element pairs) to the output character
stream as UTF-8 in a format suitable for using the
load(InputStream) method. |
void |
store(OutputStream out,
String comments,
String delimiter)
Writes this
Map (key and element pairs) to the output character
stream as UTF-8 in a format suitable for using the
load(InputStream, String) method. |
void |
store(Writer writer)
Writes this
Map (key and element pairs) to the output character
stream in a format suitable for using the
load(Reader) method. |
void |
store(Writer writer,
String comments)
Writes this
Map (key and element pairs) to the output character
stream in a format suitable for using the
load(Reader) method. |
void |
store(Writer writer,
String comments,
String delimiter)
Writes this
Map (key and element pairs) to the output character
stream in a format suitable for using the
load(Reader, String) method. |
void |
storeToJSON(OutputStream os)
Writes this
Map as JSON to the output stream as UTF-8 in a format
suitable for using the loadFromJSON(InputStream) method. |
void |
storeToJSON(Writer writer)
Writes this
Map as JSON to the writer in a format
suitable for using the
loadFromJSON(Reader) method. |
String |
storeToString(String comments)
Writes this property list (key and element pairs) in this
Properties table to the output stream as UTF-8 in a format
suitable for loading into a Properties table using the
load method. |
void |
storeToXML(OutputStream os)
Writes this
Map as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream) method. |
void |
storeToXML(OutputStream os,
String comment)
Writes this
Map as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream) method. |
void |
storeToXML(OutputStream os,
String comment,
String encoding)
Writes this
Map as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream) method. |
void |
storeToXML(OutputStream os,
String comment,
String encoding,
String delimiter)
Writes this
Map as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream, String) method. |
void |
storeToXML(Writer writer)
Writes this
Map as XML to the writer in a format suitable
for using the
loadFromXML(Reader) method. |
void |
storeToXML(Writer writer,
String comment)
Writes this
Map as XML to the writer
in a format suitable for using the
loadFromXML(Reader) method. |
void |
storeToXML(Writer writer,
String comment,
String delimiter)
Writes this
Map as XML to the writer
in a format suitable for using the
loadFromXML(InputStream, String) method. |
addMapChangeListener, clear, containsKey, containsValue, entrySet, isEmpty, keySet, removeMapChangeListener, size, toString, values
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
@Deprecated public static final String DEFAULT_MULTIVALUE_DELIMITER
.properties
files.public Properties()
HashMap
to store keys and values.public Properties(boolean caseInsensitiveKeys)
HashMap
to
store keys and values.caseInsensitiveKeys
- when true
methods taking a
key argument will consider the key being passed without
consideration for character case.public Properties(Map<String,List<String>> map)
Map
as a Properties
.
As of version 1.4 the Map
argument is decorated so that
modifications to this instance will also modify the supplied Map
.
To use a Map
to initialize values only, use the
load(Map)
method.map
- the Map to decoratepublic Properties(Map<String,List<String>> map, boolean caseInsensitiveKeys)
Map
argument as a Properties
.
As of version 1.4 the Map
argument is decorated so that
modifications to this instance will also modify the supplied Map
.
To use a Map
to initialize values only, use the
load(Map)
method.map
- the Map to decoratecaseInsensitiveKeys
- when true
methods taking a
key argument will consider the key being passed without
consideration for character case.public boolean isCaseInsensitiveKeys()
true
if case insensitive@Deprecated public String getMultiValueDelimiter()
null
.@Deprecated public void setMultiValueDelimiter(String multiValueDelimiter)
multiValueDelimiter
- multiple value string delimiterpublic String storeToString(String comments) throws IOException
Properties
table to the output stream as UTF-8 in a format
suitable for loading into a Properties
table using the
load
method.
Otherwise, the same considerations as
store(OutputStream, String)
apply.comments
- a description of the property list.IOException
- problem storing to stringpublic void store(Writer writer) throws IOException
Map
(key and element pairs) to the output character
stream in a format suitable for using the
load(Reader)
method.
If you need compatibility with Properties
consider using store(Writer, String, String)
instead.writer
- an output character stream writer.IOException
- i/o problempublic void store(Writer writer, String comments) throws IOException
Map
(key and element pairs) to the output character
stream in a format suitable for using the
load(Reader)
method.
For compatibility with Properties
consider using store(Writer, String, String)
instead.writer
- an output character stream writer.comments
- a description of the property list.IOException
- i/o problempublic void store(Writer writer, String comments, String delimiter) throws IOException
Map
(key and element pairs) to the output character
stream in a format suitable for using the
load(Reader, String)
method.
This method ensure multi-value properties will be written on the same
line, joining them by the specified delimiter. The delimiter
must be non-blank or values won't be joined.
This variant can be useful for compatibility with
Properties
, which does not support multiple values
per keys.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.IOException
- i/o problempublic void store(OutputStream out) throws IOException
Map
(key and element pairs) to the output character
stream as UTF-8 in a format suitable for using the
load(InputStream)
method.
If you need compatibility with Properties
consider using store(OutputStream, String, String)
instead.out
- an output stream.IOException
- i/o problempublic void store(OutputStream out, String comments) throws IOException
Map
(key and element pairs) to the output character
stream as UTF-8 in a format suitable for using the
load(InputStream)
method.
If you need compatibility with Properties
consider using store(OutputStream, String, String)
instead.out
- an output stream.comments
- a description of the property list.IOException
- i/o problempublic void store(OutputStream out, String comments, String delimiter) throws IOException
Map
(key and element pairs) to the output character
stream as UTF-8 in a format suitable for using the
load(InputStream, String)
method.
This method ensure multi-value properties will be written on the same
line, joining them by the specified delimiter.
This variant can be useful for compatibility with
Properties
, which does not support multiple values
per keys.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.IOException
- i/o problempublic void storeToXML(OutputStream os) throws IOException
Map
as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream)
method.
If you need compatibility with Properties
consider using storeToXML(OutputStream, String, String, String)
instead.os
- the output stream on which to emit the XML document.IOException
- i/o problempublic void storeToXML(OutputStream os, String comment) throws IOException
Map
as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream)
method.
If you need compatibility with Properties
consider using storeToXML(OutputStream, String, String, String)
instead.os
- the output stream on which to emit the XML document.comment
- a description of the property list, or null
if no comment is desired.IOException
- i/o problempublic void storeToXML(OutputStream os, String comment, String encoding) throws IOException
Map
as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream)
method.
If you need compatibility with Properties
consider using storeToXML(OutputStream, String, String, String)
instead.os
- the output stream on which to emit the XML document.comment
- a description of the property list, or null
if no comment is desired.encoding
- character encodingIOException
- i/o problempublic void storeToXML(OutputStream os, String comment, String encoding, String delimiter) throws IOException
Map
as XML to the output character
stream using UTF-8 in a format suitable for using the
loadFromXML(InputStream, String)
method.
This method ensure multi-value properties will be written on the same
line, joining them by the specified delimiter (if not null).
This variant can be useful for compatibility with
Properties
, which does not support multiple values
per keys.os
- the output stream on which to emit the XML document.comment
- a description of the property list, or null
if no comment is desired.encoding
- character encodingdelimiter
- delimiter string to used as a separator when joining
multiple values for the same key.IOException
- i/o problempublic void storeToXML(Writer writer) throws IOException
Map
as XML to the writer in a format suitable
for using the
loadFromXML(Reader)
method.
If you need compatibility with Properties
consider using storeToXML(Writer, String, String)
instead.writer
- writer on which to store the XML document.IOException
- i/o problempublic void storeToXML(Writer writer, String comment) throws IOException
Map
as XML to the writer
in a format suitable for using the
loadFromXML(Reader)
method.
If you need compatibility with Properties
consider using storeToXML(Writer, String, String)
instead.writer
- the writer on which to store the XML document.comment
- a description of the property list, or null
if no comment is desired.IOException
- i/o problempublic void storeToXML(Writer writer, String comment, String delimiter) throws IOException
Map
as XML to the writer
in a format suitable for using the
loadFromXML(InputStream, String)
method.
This method ensure multi-value properties will be written on the same
line, joining them by the specified delimiter (if not null).
This variant can be useful for compatibility with
Properties
, which does not support multiple values
per keys.writer
- the writer on which to store the XML document.comment
- a description of the property list, or null
if no comment is desired.delimiter
- delimiter string to used as a separator when joining
multiple values for the same key.IOException
- i/o problempublic void storeToJSON(OutputStream os) throws IOException
Map
as JSON to the output stream as UTF-8 in a format
suitable for using the loadFromJSON(InputStream)
method.os
- the output stream on which to store the properties.IOException
- i/o problempublic void storeToJSON(Writer writer) throws IOException
Map
as JSON to the writer in a format
suitable for using the
loadFromJSON(Reader)
method.writer
- the writer on which to store the XML document.IOException
- i/o problempublic void loadFromString(String str) throws IOException
load(InputStream)
apply.str
- the string to loadIOException
- problem loading stringpublic void load(Map<?,?> map)
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. null
keys are ignored.
null
values 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 a Map
argument.
map
- the map containing values to loadpublic void load(Reader reader) throws IOException
store(Writer)
method.reader
- the input character stream.IOException
- i/o problempublic void load(Reader reader, String delimiter) throws IOException
store(Writer, String, String)
method.
If a key was stored with multiple values using a delimiter,
this method will split these values appropriately provided the
supplied delimiter is the same.reader
- the input character stream.delimiter
- delimiter string to used to parse a multi-value key.IOException
- i/o problemload(Reader)
public void load(InputStream inStream) throws IOException
store(OutputStream, String, String)
method.inStream
- the input stream.IOException
- i/o problemload(InputStream)
public void load(InputStream inStream, String encoding) throws IOException
store(OutputStream, String, String)
method.
Since 1.14.0, use load(InputStream, String, String)
to load properties file with a delimiter for multi-values.inStream
- the input stream.encoding
- delimiter string to used to parse a multi-value key.IOException
- i/o problemload(InputStream)
public void load(InputStream inStream, String encoding, String delimiter) throws IOException
store(OutputStream, String, String)
method.
If a key was stored with multiple values using a delimiter,
this method will split these values appropriately provided the
supplied delimiter is the same.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.IOException
- i/o problempublic void loadFromXML(InputStream in) throws IOException
in
- in the input stream from which to read the XML document.IOException
- i/o problempublic void loadFromXML(InputStream in, String encoding) throws IOException
loadFromXML(InputStream, String, String)
to load an XML with a delimiter for multi-values.in
- in the input stream from which to read the XML document.encoding
- delimiter string to used to parse a multi-value key.IOException
- i/o problempublic void loadFromXML(InputStream in, String encoding, String delimiter) throws IOException
in
- in the input stream from which to read the XML document.encoding
- character encodingdelimiter
- delimiter string to used to parse a multi-value key.IOException
- i/o problempublic void loadFromXML(Reader reader) throws IOException
reader
- the reader from which to read the XML document.IOException
- i/o problempublic void loadFromXML(Reader reader, String delimiter) throws IOException
reader
- reader from which to read the XML document.delimiter
- delimiter string to used to parse a multi-value key.IOException
- i/o problempublic void loadFromJSON(InputStream in) throws IOException
in
- the input stream from which to read the JSON document.IOException
- i/o problempublic void loadFromJSON(Reader reader) throws IOException
reader
- the reader from which to read the JSON document.IOException
- i/o problempublic final String getString(String key)
key
- property keypublic final String getString(String key, String defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<String> getStrings(String key)
key
- property keypublic final void setString(String key, String... values)
null
value or an empty string array is
the same as calling remove(Object)
with the same key.
When setting multiple values, null
values are converted
to blank strings.key
- the key of the value to setvalues
- the values to setpublic final void addString(String key, String... values)
null
value has no effect.
When adding multiple values, null
values are converted
to blank strings.key
- the key of the value to setvalues
- the values to setpublic final int getInt(String key)
key
- property keypublic final int getInt(String key, int defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<Integer> getInts(String key)
key
- property keypublic final void setInt(String key, int... values)
key
- the key of the values to setvalues
- the values to setpublic final void addInt(String key, int... values)
key
- the key of the values to setvalues
- the values to setpublic final double getDouble(String key)
key
- property keypublic final double getDouble(String key, double defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<Double> getDoubles(String key)
key
- property keypublic final void setDouble(String key, double... values)
key
- the key of the values to setvalues
- the values to setpublic final void addDouble(String key, double... values)
key
- the key of the values to setvalues
- the values to setpublic final long getLong(String key)
key
- property keypublic final long getLong(String key, long defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<Long> getLongs(String key)
key
- property keypublic final void setLong(String key, long... values)
key
- the key of the values to setvalues
- the values to setpublic final void addLong(String key, long... values)
key
- the key of the values to setvalues
- the values to setpublic final float getFloat(String key)
key
- property keypublic final float getFloat(String key, float defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<Float> getFloats(String key)
key
- property keypublic final void setFloat(String key, float... values)
key
- the key of the values to setvalues
- the values to setpublic final void addFloat(String key, float... values)
key
- the key of the values to setvalues
- the values to setpublic final BigDecimal getBigDecimal(String key)
key
- property keypublic final BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<BigDecimal> getBigDecimals(String key)
key
- property keypublic final void setBigDecimal(String key, BigDecimal... values)
key
- the key of the values to setvalues
- the values to setpublic final void addBigDecimal(String key, BigDecimal... values)
key
- the key of the values to setvalues
- the values to setpublic final Date getDate(String key)
key
- property keypublic final Date getDate(String key, Date defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<Date> getDates(String key)
key
- property keypublic final void setDate(String key, Date... values)
key
- the key of the values to setvalues
- the values to setpublic final void addDate(String key, Date... values)
key
- the key of the values to setvalues
- the values to setpublic final boolean getBoolean(String key)
true
. Any other value (including null
)
will return false
.key
- property keypublic final boolean getBoolean(String key, boolean defaultValue)
true
. Any other value (including null
)
will return false
. If there are no entries for the given
key, the default value is returned instead.key
- property keydefaultValue
- default value to return when original value is null.public final List<Boolean> getBooleans(String key)
key
- property keypublic final void setBoolean(String key, boolean... values)
key
- the key of the values to setvalues
- the values to setpublic final void addBoolean(String key, boolean... values)
key
- the key of the values to setvalues
- the values to setpublic final Locale getLocale(String key)
key
- property keypublic final Locale getLocale(String key, Locale defaultValue)
key
- property keydefaultValue
- default value to return when original value is null.public final List<Locale> getLocales(String key)
key
- property keypublic final void setLocale(String key, Locale... values)
key
- the key of the values to setvalues
- the values to setpublic final void addLocale(String key, Locale... values)
key
- the key of the values to setvalues
- the values to setpublic final File getFile(String key)
key
- properties keypublic final File getFile(String key, File defaultValue)
key
- properties keydefaultValue
- default file being returned if no file has been
defined for the given key in the properties.public final List<File> getFiles(String key)
key
- property keypublic final void setFile(String key, File... values)
key
- the key of the values to setvalues
- the values to setpublic final void addFile(String key, File... values)
key
- the key of the values to setvalues
- the values to setpublic final Class<?> getClass(String key)
key
- properties keypublic final Class<?> getClass(String key, Class<?> defaultValue)
key
- properties keydefaultValue
- default file being returned if no class has been
defined for the given key in the properties.public final List<Class<?>> getClasses(String key)
key
- property keypublic final void setClass(String key, Class<?>... values)
key
- the key of the values to setvalues
- the values to setpublic final void addClass(String key, Class<?>... values)
key
- the key of the values to setvalues
- the values to setCopyright © 2008–2021 Norconex Inc.. All rights reserved.