Class Properties

All Implemented Interfaces:
Serializable, Map<String,List<String>>
Direct Known Subclasses:
QueryString

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. 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:
  • Field Details

  • Constructor Details

    • Properties

      public Properties()
      Create a new instance with case-sensitive keys. Internally wraps a HashMap to store keys and values.
    • Properties

      public Properties(boolean caseInsensitiveKeys)
      Creates a new instance. Internally wraps a HashMap to store keys and values.
      Parameters:
      caseInsensitiveKeys - when true methods taking a key argument will consider the key being passed without consideration for character case.
    • Properties

      public Properties(Map<String,List<String>> map)
      Decorates 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 loadFromMap(Map) method.
      Parameters:
      map - the Map to decorate
    • Properties

      public Properties(Map<String,List<String>> map, boolean caseInsensitiveKeys)
      Decorates a 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 loadFromMap(Map) method.
      Parameters:
      map - the Map to decorate
      caseInsensitiveKeys - when true methods 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:
      true if case insensitive
      Since:
      1.8
    • matchKeys

      public Properties matchKeys(TextMatcher keyMatcher)
      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

      public Properties matchValues(TextMatcher valueMatcher)
      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

      public Properties match(PropertyMatcher propertyMatcher)
      Gets a properties subset for keys and values matched by the property matcher. Same as invoking match(TextMatcher, TextMatcher).
      Parameters:
      propertyMatcher - property matcher
      Returns:
      properties subset or empty properties (never null)
      Since:
      2.0.0
    • match

      public Properties match(TextMatcher fieldMatcher, TextMatcher valueMatcher)
      Gets a properties subset for matching keys and values. Same as invoking match(PropertyMatcher).
      Parameters:
      fieldMatcher - property matcher
      valueMatcher - property value
      Returns:
      properties subset or empty properties (never null)
      Since:
      2.0.0
    • toString

      public String toString()
      Returns this Map in a format compatible with Properties.store(Writer, String). Multi-value properties are merged, joined by the symbol for record separator (U+241E).
      Overrides:
      toString in class ObservableMap<String,List<String>>
      Returns:
      the properties as string
      Since:
      2.0.0
    • storeToProperties

      public void storeToProperties(Writer writer) throws IOException
      Stores this Map in a format compatible with Properties.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

      public void storeToProperties(Writer writer, String delimiter) throws IOException
      Stores this Map in a format compatible with Properties.store(Writer, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter is null, 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

      public void storeToProperties(OutputStream out) throws IOException
      Stores this Map in a format compatible with Properties.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

      public void storeToProperties(OutputStream out, String delimiter) throws IOException
      Stores this Map in a format compatible with Properties.store(OutputStream, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter is null, 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

      public void storeToXML(OutputStream os) throws IOException
      Stores this Map in a UTF-8 format compatible with Properties.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

      public void storeToXML(OutputStream os, String delimiter) throws IOException
      Stores this Map in a UTF-8 format compatible with Properties.storeToXML(OutputStream, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter is null, 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

      public void storeToXML(Writer writer) throws IOException
      Stores this Map in a UTF-8 format compatible with Properties.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

      public void storeToXML(Writer writer, String delimiter) throws IOException
      Stores this Map in a UTF-8 format compatible with Properties.storeToXML(OutputStream, String). Multi-value properties are merged, joined by the supplied delimiter character. If the delimiter is null, 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

      public void storeToJSON(OutputStream os) throws IOException
      Writes this Map as JSON to the output stream as UTF-8 in a format suitable for using the loadFromJSON(InputStream) method.
      Parameters:
      os - the output stream on which to store the properties.
      Throws:
      IOException - i/o problem
      Since:
      1.14.0
    • storeToJSON

      public void storeToJSON(Writer writer) throws IOException
      Writes this Map as JSON to the writer in a format suitable for using the loadFromJSON(Reader) method.
      Parameters:
      writer - the writer on which to store the XML document.
      Throws:
      IOException - i/o problem
      Since:
      1.14.0
    • storeToBean

      public void storeToBean(Object bean)
      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. null beans are ignored.
      Parameters:
      bean - the object to store properties into
      Since:
      2.0.0
    • fromString

      public void fromString(String str)
      Reads a property list (key and element pairs) from the input string. Otherwise, the same considerations as loadFromProperties(InputStream) apply.
      Parameters:
      str - the string to load
    • toProperties

      public Properties toProperties()
      Converts this Map to a new Java Properties instance. Multi-value properties are merged, joined by the symbol for record separator (U+241E).
      Returns:
      a java.util.Properties instance
      Since:
      2.0.0
      See Also:
    • loadFromMap

      public void loadFromMap(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.

      You can use this method to populate this Map from a Properties.

      Parameters:
      map - the map containing values to load
      Since:
      2.0.0
    • loadFromProperties

      public void loadFromProperties(Reader reader) throws IOException
      Loads this Map from an input of a format compatible with Properties.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

      public void loadFromProperties(Reader reader, String delimiter) throws IOException
      Loads this Map from an input of a format compatible with Properties.load(Reader). Multi-value properties are split using the supplied delimiter string. If the delimiter is null, 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

      public void loadFromProperties(InputStream inStream) throws IOException
      Loads this Map from an input of a format compatible with Properties.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

      public void loadFromProperties(InputStream inStream, String delimiter) throws IOException
      Loads this Map from an input of a format compatible with Properties.load(InputStream). Multi-value properties are split using the supplied delimiter string. If the delimiter is null, 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

      public void loadFromXML(InputStream in) throws IOException
      Loads this Map from an input of a format compatible with Properties.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

      public void loadFromXML(InputStream in, String delimiter) throws IOException
      Loads this Map from an input of a format compatible with Properties.load(InputStream). Multi-value properties are split using the supplied delimiter string. If the delimiter is null, 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

      public void loadFromXML(Reader reader) throws IOException
      Loads this Map from an input of a format compatible with Properties.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

      public void loadFromXML(Reader reader, String delimiter) throws IOException
      Loads this Map from an input of a format compatible with Properties.load(InputStream). Multi-value properties are split using the supplied delimiter string. If the delimiter is null, 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

      public void loadFromJSON(InputStream in) throws IOException
      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

      public void loadFromJSON(Reader reader) throws IOException
      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

      public void loadFromBean(Object bean)
      Converts all the bean properties into entries in this instance. null beans are ignored.
      Parameters:
      bean - the object to load properties from
      Since:
      2.0.0
    • get

      public final <T> T get(String key, Class<T> type)
      Gets a single value, converted to the given type.
      Type Parameters:
      T - returned value type
      Parameters:
      key - the key of the value to get
      type - target class of value
      Returns:
      value
      Since:
      2.0.0
    • get

      public final <T> T get(String key, Class<T> type, T defaultValue)
      Gets a single value, converted to the given type.
      Type Parameters:
      T - returned value type
      Parameters:
      key - the key of the value to get
      type - target class of value
      defaultValue - default value if key has no value.
      Returns:
      value
      Since:
      2.0.0
    • getList

      public final <T> List<T> getList(String key, Class<T> type)
      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 get
      type - target class of values
      Returns:
      value list
      Since:
      2.0.0
    • getList

      public final <T> List<T> getList(String key, Class<T> type, List<T> defaultValues)
      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 get
      type - target class of values
      defaultValues - default values if the key returns null or an empty list
      Returns:
      value list
      Since:
      2.0.0
    • set

      @SafeVarargs public final <T> void set(String key, T... values)
      Sets one or multiple values as strings replacing existing ones. Setting a single null value or an empty array is the same as calling remove(Object) with the same key. When setting multiple values, null values are converted to empty strings.
      Type Parameters:
      T - values type
      Parameters:
      key - the key of the value to set
      values - the values to set
      Since:
      2.0.0
    • add

      @SafeVarargs public final <T> void add(String key, T... values)
      Adds one or multiple string values. Adding a single null value has no effect. When adding multiple values, null values are converted to blank strings.
      Type Parameters:
      T - values type
      Parameters:
      key - the key of the value to set
      values - the values to set
      Since:
      2.0.0
    • setList

      public final <T> void setList(String key, List<T> values)
      Sets one or multiple values as strings replacing existing ones. Setting a single null value or an empty array is the same as calling remove(Object) with the same key. When setting multiple values, null values are converted to empty strings.
      Type Parameters:
      T - values type
      Parameters:
      key - the key of the value to set
      values - the values to set
      Since:
      2.0.0
    • addList

      public final <T> void addList(String key, List<T> values)
      Adds one or multiple values as strings. Adding a null list has no effect. When adding multiple values, null values are converted to empty strings.
      Type Parameters:
      T - values type
      Parameters:
      key - the key of the value to set
      values - the values to set
      Since:
      2.0.0
    • getString

      public final String getString(String key)
      Gets value as string.
      Parameters:
      key - property key
      Returns:
      the value
    • getString

      public final String getString(String key, String defaultValue)
      Gets value as string.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getStrings

      public final List<String> getStrings(String key)
      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 public final void setString(String key, String... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple string values replacing existing ones. Setting a single 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.
      Parameters:
      key - the key of the value to set
      values - the values to set
    • addString

      @Deprecated public final void addString(String key, String... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple string values. Adding a single null value has no effect. When adding multiple values, null values are converted to blank strings.
      Parameters:
      key - the key of the value to set
      values - the values to set
    • getInteger

      public final Integer getInteger(String key)
      Gets value as an integer.
      Parameters:
      key - property key
      Returns:
      the value
    • getInteger

      public final Integer getInteger(String key, Integer defaultValue)
      Gets value as an integer.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getIntegers

      public final List<Integer> getIntegers(String key)
      Gets values as a list of integers.
      Parameters:
      key - property key
      Returns:
      the values
    • setInt

      @Deprecated public final void setInt(String key, int... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple integer values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addInt

      @Deprecated public final void addInt(String key, int... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple integer values values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getDouble

      public final Double getDouble(String key)
      Gets value as a double.
      Parameters:
      key - property key
      Returns:
      the value
    • getDouble

      public final Double getDouble(String key, Double defaultValue)
      Gets value as a double.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getDoubles

      public final List<Double> getDoubles(String key)
      Gets values as a list of doubles.
      Parameters:
      key - property key
      Returns:
      the values
    • setDouble

      @Deprecated public final void setDouble(String key, double... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple double values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addDouble

      @Deprecated public final void addDouble(String key, double... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple double values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getLong

      public final Long getLong(String key)
      Gets value as a long.
      Parameters:
      key - property key
      Returns:
      the value
    • getLong

      public final Long getLong(String key, Long defaultValue)
      Gets value as a long.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getLongs

      public final List<Long> getLongs(String key)
      Gets values as a list of longs.
      Parameters:
      key - property key
      Returns:
      the values
    • setLong

      @Deprecated public final void setLong(String key, long... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple long values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addLong

      @Deprecated public final void addLong(String key, long... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Add one or multiple long values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getFloat

      public final Float getFloat(String key)
      Gets value as a float.
      Parameters:
      key - property key
      Returns:
      the value
    • getFloat

      public final Float getFloat(String key, Float defaultValue)
      Gets value as a float.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getFloats

      public final List<Float> getFloats(String key)
      Gets values as a list of floats.
      Parameters:
      key - property key
      Returns:
      the values
    • setFloat

      @Deprecated public final void setFloat(String key, float... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple float values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addFloat

      @Deprecated public final void addFloat(String key, float... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple long values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getBigDecimal

      public final BigDecimal getBigDecimal(String key)
      Gets value as a BigDecimal.
      Parameters:
      key - property key
      Returns:
      the value
    • getBigDecimal

      public final BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
      Gets value as a BigDecimal.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getBigDecimals

      public final List<BigDecimal> getBigDecimals(String key)
      Gets values as a list of BigDecimals.
      Parameters:
      key - property key
      Returns:
      the values
    • setBigDecimal

      @Deprecated public final void setBigDecimal(String key, BigDecimal... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple BigDecimal values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addBigDecimal

      @Deprecated public final void addBigDecimal(String key, BigDecimal... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Add one or multiple BigDecimal values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getLocalDateTime

      public final LocalDateTime getLocalDateTime(String key)
      Gets value as a local date-time. The date must be a valid date-time as defined by DateTimeFormatter.ISO_LOCAL_DATE_TIME.
      Parameters:
      key - property key
      Returns:
      the value
      Since:
      2.0.0
    • getLocalDateTime

      public final LocalDateTime getLocalDateTime(String key, LocalDateTime defaultValue)
      Gets value as a local date-time. The date must be a valid date-time as defined by DateTimeFormatter.ISO_LOCAL_DATE_TIME.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
      Since:
      2.0.0
    • getLocalDateTimes

      public final List<LocalDateTime> getLocalDateTimes(String key)
      Gets values as a list of local date-times. Each date must be a valid date-time as defined by DateTimeFormatter.ISO_LOCAL_DATE_TIME.
      Parameters:
      key - property key
      Returns:
      the values
      Since:
      2.0.0
    • getInstant

      public final Instant getInstant(String key)
      Gets value as a UTC date-time Instant. The date must be a valid date-time as defined by DateTimeFormatter.ISO_INSTANT.
      Parameters:
      key - property key
      Returns:
      the value
      Since:
      2.0.0
    • getInstant

      public final Instant getInstant(String key, Instant defaultValue)
      Gets value as a UTC date-time Instant. The date must be a valid date-time as defined by DateTimeFormatter.ISO_INSTANT.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
      Since:
      2.0.0
    • getInstants

      public final List<Instant> getInstants(String key)
      Gets values as a list of UTC date-time Instants. Each date must be a valid date-time as defined by DateTimeFormatter.ISO_INSTANT.
      Parameters:
      key - property key
      Returns:
      the values
      Since:
      2.0.0
    • getDate

      public final Date getDate(String key)
      Gets value as a date.
      Parameters:
      key - property key
      Returns:
      the value
    • getDate

      public final Date getDate(String key, Date defaultValue)
      Gets value as a date.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getDates

      public final List<Date> getDates(String key)
      Gets values as a list of dates.
      Parameters:
      key - property key
      Returns:
      the values
    • setDate

      @Deprecated public final void setDate(String key, Date... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple date values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addDate

      @Deprecated public final void addDate(String key, Date... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Add one or multiple date values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getBoolean

      public final Boolean getBoolean(String key)
      Gets value as a boolean. The underlying string value matching the key must exist and equal "true" (ignoring case) to return true. Any other value (including null) will return false.
      Parameters:
      key - property key
      Returns:
      the value
    • getBoolean

      public final Boolean getBoolean(String key, Boolean defaultValue)
      Gets value as a boolean. The underlying string value matching the key must exist and equal "true" (ignoring case) to return true. Any other value (including null) will return false. If there are no entries for the given key, the default value is returned instead.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getBooleans

      public final List<Boolean> getBooleans(String key)
      Gets values as a list of booleans.
      Parameters:
      key - property key
      Returns:
      the values
    • setBoolean

      @Deprecated public final void setBoolean(String key, boolean... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple boolean values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addBoolean

      @Deprecated public final void addBoolean(String key, boolean... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple boolean values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getLocale

      public final Locale getLocale(String key)
      Gets value as a locale.
      Parameters:
      key - property key
      Returns:
      the value
    • getLocale

      public final Locale getLocale(String key, Locale defaultValue)
      Gets value as a locale.
      Parameters:
      key - property key
      defaultValue - default value to return when original value is null.
      Returns:
      the value
    • getLocales

      public final List<Locale> getLocales(String key)
      Gets values as a list of locales.
      Parameters:
      key - property key
      Returns:
      the values
    • setLocale

      @Deprecated public final void setLocale(String key, Locale... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple locale values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addLocale

      @Deprecated public final void addLocale(String key, Locale... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple locale values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getFile

      public final File getFile(String key)
      Gets a file, assuming key value is a file system path.
      Parameters:
      key - properties key
      Returns:
      a File
    • getFile

      public final File getFile(String key, File defaultValue)
      Gets a file, assuming key value is a file system path.
      Parameters:
      key - properties key
      defaultValue - default file being returned if no file has been defined for the given key in the properties.
      Returns:
      a File
    • getFiles

      public final List<File> getFiles(String key)
      Gets values as a list of files.
      Parameters:
      key - property key
      Returns:
      the values
    • setFile

      @Deprecated public final void setFile(String key, File... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple file values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addFile

      @Deprecated public final void addFile(String key, File... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple file values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • getClass

      public final Class<?> getClass(String key)
      Gets a class, assuming key value is a fully qualified class name available in the classloader.
      Parameters:
      key - properties key
      Returns:
      initialized class
    • getClass

      public final Class<?> getClass(String key, Class<?> defaultValue)
      Gets a class, assuming key value is a fully qualified class name available in the classloader.
      Parameters:
      key - properties key
      defaultValue - default file being returned if no class has been defined for the given key in the properties.
      Returns:
      initialized class
    • getClasses

      public final List<Class> getClasses(String key)
      Gets values as a list of initialized classes.
      Parameters:
      key - property key
      Returns:
      the values
    • setClass

      @Deprecated public final void setClass(String key, Class<?>... values)
      Deprecated.
      Since 2.0.0, use set(String, Object...)
      Sets one or multiple class values, replacing existing ones.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • addClass

      @Deprecated public final void addClass(String key, Class<?>... values)
      Deprecated.
      Since 2.0.0, use add(String, Object...)
      Adds one or multiple class values.
      Parameters:
      key - the key of the values to set
      values - the values to set
    • get

      public final List<String> get(Object key)
      Specified by:
      get in interface Map<String,List<String>>
      Overrides:
      get in class ObservableMap<String,List<String>>
    • remove

      public final List<String> remove(Object key)
      Specified by:
      remove in interface Map<String,List<String>>
      Overrides:
      remove in class ObservableMap<String,List<String>>
    • put

      public List<String> put(String key, List<String> values)
      Specified by:
      put in interface Map<String,List<String>>
      Overrides:
      put in class ObservableMap<String,List<String>>
    • putAll

      public void putAll(Map<? extends String,? extends List<String>> m)
      Specified by:
      putAll in interface Map<String,List<String>>
      Overrides:
      putAll in class ObservableMap<String,List<String>>
    • valueList

      public List<String> 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 public void load(Reader reader) throws IOException
      Deprecated.
      Since 2.0.0, use loadFromProperties(...)
      Deprecated.
      Parameters:
      reader - the input character stream.
      Throws:
      IOException - i/o problem
    • load

      @Deprecated public void load(Reader reader, String delimiter) throws IOException
      Deprecated.
      Since 2.0.0, use loadFromProperties(...)
      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 public void load(InputStream inStream) throws IOException
      Deprecated.
      Since 2.0.0, use loadFromProperties(...)
      Deprecated.
      Parameters:
      inStream - the input stream.
      Throws:
      IOException - i/o problem
      See Also:
    • load

      @Deprecated public void load(InputStream inStream, String encoding) throws IOException
      Deprecated.
      Since 2.0.0, use loadFromProperties(...)
      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, use loadFromProperties(...)
      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 public void store(Writer writer) throws IOException
      Deprecated.
      Since 2.0.0, use storeToProperties(...)
      Deprecated.
      Parameters:
      writer - an output character stream writer.
      Throws:
      IOException - i/o problem
    • store

      @Deprecated public void store(Writer writer, String comments) throws IOException
      Deprecated.
      Since 2.0.0, use storeToProperties(...)
      Deprecated.
      Parameters:
      writer - an output character stream writer.
      comments - a description of the property list.
      Throws:
      IOException - i/o problem
    • store

      @Deprecated public void store(Writer writer, String comments, String delimiter) throws IOException
      Deprecated.
      Since 2.0.0, use storeToProperties(...)
      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 public void store(OutputStream out) throws IOException
      Deprecated.
      Since 2.0.0, use storeToProperties(...)
      Deprecated.
      Parameters:
      out - an output stream.
      Throws:
      IOException - i/o problem
    • store

      @Deprecated public void store(OutputStream out, String comments) throws IOException
      Deprecated.
      Since 2.0.0, use storeToProperties(...)
      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, use storeToProperties(...)
      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

      public boolean equals(Object other)
      Specified by:
      equals in interface Map<String,List<String>>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<String,List<String>>
      Overrides:
      hashCode in class Object