Class DataConfiguration

All Implemented Interfaces:
Configuration, EventSource, ImmutableConfiguration, SynchronizerSupport

Decorator providing additional getters for any Configuration. This extended Configuration supports more types: Lists and arrays are available for all types.
Note that this class is only a thin wrapper over functionality already provided by AbstractConfiguration. Basically, the generic get(), and getCollection() methods are used to actually perform data conversions.

Example

Configuration file config.properties:
 title.color = #0000FF
 remote.host = 192.168.0.53
 default.locales = fr,en,de
 email.contact = dev@test.org, tester@test.org
 
Usage:
 DataConfiguration config = new DataConfiguration(new PropertiesConfiguration("config.properties"));

 // retrieve a property using a specialized getter
 Color color = config.getColor("title.color");

 // retrieve a property using a generic getter
 InetAddress host = (InetAddress) config.get(InetAddress.class, "remote.host");
 Locale[] locales = (Locale[]) config.getArray(Locale.class, "default.locales");
 List contacts = config.getList(InternetAddress.class, "email.contact");
 

Dates

Date objects are expected to be formatted with the pattern yyyy-MM-dd HH:mm:ss. This default format can be changed by specifying another format in the getters, or by putting a date format in the configuration under the key org.apache.commons.configuration.format.date. Alternatively, the date format can also be specified via the ConversionHandler used by a configuration instance:
 DefaultConversionHandler handler = new DefaultConversionHandler();
 handler.setDateFormat("mm/dd/yyyy");
 config.setConversionHandler(handler);
 
Since:
1.1
  • Field Details Link icon

  • Constructor Details Link icon

    • DataConfiguration Link icon

      public DataConfiguration(Configuration configuration)
      Creates a new instance of DataConfiguration and sets the wrapped configuration.
      Parameters:
      configuration - the wrapped configuration
  • Method Details Link icon

    • addPropertyDirect Link icon

      protected void addPropertyDirect(String key, Object value)
      Description copied from class: AbstractConfiguration
      Adds a key/value pair to the Configuration. Override this method to provide write access to underlying Configuration store.
      Specified by:
      addPropertyDirect in class AbstractConfiguration
      Parameters:
      key - key to use for mapping
      value - object to store
    • addPropertyInternal Link icon

      protected void addPropertyInternal(String key, Object obj)
      Description copied from class: AbstractConfiguration
      Actually adds a property to this configuration. This method is called by addProperty(). It performs list splitting if necessary and delegates to AbstractConfiguration.addPropertyDirect(String, Object) for every single property value.
      Overrides:
      addPropertyInternal in class AbstractConfiguration
      Parameters:
      key - the key of the property to be added
      obj - the new property value
    • clearPropertyDirect Link icon

      protected void clearPropertyDirect(String key)
      Description copied from class: AbstractConfiguration
      Removes the specified property from this configuration. This method is called by clearProperty() after it has done some preparations. It must be overridden in sub classes.
      Specified by:
      clearPropertyDirect in class AbstractConfiguration
      Parameters:
      key - the key to be removed
    • containsKeyInternal Link icon

      protected boolean containsKeyInternal(String key)
      Description copied from class: AbstractConfiguration
      Actually checks whether the specified key is contained in this configuration. This method is called by containsKey(). It has to be defined by concrete subclasses.
      Specified by:
      containsKeyInternal in class AbstractConfiguration
      Parameters:
      key - the key in question
      Returns:
      true if this key is contained in this configuration, false otherwise
    • containsValueInternal Link icon

      protected boolean containsValueInternal(Object value)
      Tests whether this configuration contains one or more matches to this value. This operation stops at first match but may be more expensive than the containsKey method.
      Specified by:
      containsValueInternal in class AbstractConfiguration
      Parameters:
      value - the value in question
      Returns:
      true if and only if some key maps to the value argument in this configuration as determined by the equals method; false otherwise.
      Since:
      2.11.0
    • getBigDecimalArray Link icon

      Gets an array of BigDecimals associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated BigDecimal array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigDecimals.
    • getBigDecimalArray Link icon

      public BigDecimal[] getBigDecimalArray(String key, BigDecimal... defaultValue)
      Gets an array of BigDecimals associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated BigDecimal array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigDecimals.
    • getBigDecimalList Link icon

      Gets a list of BigDecimals associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated BigDecimal list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigDecimals.
    • getBigDecimalList Link icon

      public List<BigDecimal> getBigDecimalList(String key, List<BigDecimal> defaultValue)
      Gets a list of BigDecimals associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of BigDecimals.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigDecimals.
    • getBigIntegerArray Link icon

      Gets an array of BigIntegers associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated BigInteger array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigIntegers.
    • getBigIntegerArray Link icon

      public BigInteger[] getBigIntegerArray(String key, BigInteger... defaultValue)
      Gets an array of BigIntegers associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated BigInteger array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigIntegers.
    • getBigIntegerList Link icon

      Gets a list of BigIntegers associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated BigInteger list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigIntegers.
    • getBigIntegerList Link icon

      public List<BigInteger> getBigIntegerList(String key, List<BigInteger> defaultValue)
      Gets a list of BigIntegers associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of BigIntegers.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of BigIntegers.
    • getBooleanArray Link icon

      public boolean[] getBooleanArray(String key)
      Gets an array of boolean primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated boolean array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of booleans.
    • getBooleanArray Link icon

      public boolean[] getBooleanArray(String key, boolean... defaultValue)
      Gets an array of boolean primitives associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated boolean array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of booleans.
    • getBooleanList Link icon

      Gets a list of Boolean objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Boolean list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of booleans.
    • getBooleanList Link icon

      public List<Boolean> getBooleanList(String key, List<Boolean> defaultValue)
      Gets a list of Boolean objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Booleans.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of booleans.
    • getByteArray Link icon

      public byte[] getByteArray(String key)
      Gets an array of byte primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated byte array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of bytes.
    • getByteArray Link icon

      public byte[] getByteArray(String key, byte... defaultValue)
      Gets an array of byte primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated byte array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of bytes.
    • getByteList Link icon

      public List<Byte> getByteList(String key)
      Gets a list of Byte objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Byte list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of bytes.
    • getByteList Link icon

      public List<Byte> getByteList(String key, List<Byte> defaultValue)
      Gets a list of Byte objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Bytes.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of bytes.
    • getCalendar Link icon

      public Calendar getCalendar(String key)
      Gets a Calendar associated with the given configuration key. If the property is a String, it will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Calendar.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Calendar.
    • getCalendar Link icon

      public Calendar getCalendar(String key, Calendar defaultValue)
      Gets a Calendar associated with the given configuration key. If the property is a String, it will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated Calendar.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Calendar.
    • getCalendar Link icon

      public Calendar getCalendar(String key, Calendar defaultValue, String format)
      Gets a Calendar associated with the given configuration key. If the property is a String, it will be parsed with the specified format pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Calendar.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Calendar.
    • getCalendar Link icon

      public Calendar getCalendar(String key, String format)
      Gets a Calendar associated with the given configuration key. If the property is a String, it will be parsed with the specified format pattern.
      Parameters:
      key - The configuration key.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Calendar
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Calendar.
    • getCalendarArray Link icon

      Gets an array of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Calendar array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarArray Link icon

      public Calendar[] getCalendarArray(String key, Calendar... defaultValue)
      Gets an array of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated Calendar array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarArray Link icon

      public Calendar[] getCalendarArray(String key, Calendar[] defaultValue, String format)
      Gets an array of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Calendar array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarArray Link icon

      public Calendar[] getCalendarArray(String key, String format)
      Gets an array of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Calendar array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarList Link icon

      Gets a list of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Calendar list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarList Link icon

      public List<Calendar> getCalendarList(String key, List<Calendar> defaultValue)
      Gets a list of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated Calendar list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarList Link icon

      public List<Calendar> getCalendarList(String key, List<Calendar> defaultValue, String format)
      Gets a list of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Calendar list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getCalendarList Link icon

      public List<Calendar> getCalendarList(String key, String format)
      Gets a list of Calendars associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Calendar list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Calendars.
    • getColor Link icon

      public Color getColor(String key)
      Gets a Color associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Color.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Color.
    • getColor Link icon

      public Color getColor(String key, Color defaultValue)
      Gets a Color associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated Color.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Color.
    • getColorArray Link icon

      public Color[] getColorArray(String key)
      Gets an array of Colors associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Color array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Colors.
    • getColorArray Link icon

      public Color[] getColorArray(String key, Color... defaultValue)
      Gets an array of Colors associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated Color array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Colors.
    • getColorList Link icon

      public List<Color> getColorList(String key)
      Gets a list of Colors associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Color list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Colors.
    • getColorList Link icon

      public List<Color> getColorList(String key, List<Color> defaultValue)
      Gets a list of Colors associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Colors.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Colors.
    • getConfiguration Link icon

      Gets the configuration decorated by this DataConfiguration.
      Returns:
      the wrapped configuration
    • getConversionHandler Link icon

      Gets the ConversionHandler used by this instance. This implementation returns the special conversion handler used by this configuration instance.
      Overrides:
      getConversionHandler in class AbstractConfiguration
      Returns:
      the ConversionHandler
    • getDate Link icon

      public Date getDate(String key)
      Gets a Date associated with the given configuration key. If the property is a String, it will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Date.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Date.
    • getDate Link icon

      public Date getDate(String key, Date defaultValue)
      Gets a Date associated with the given configuration key. If the property is a String, it will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated Date.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Date.
    • getDate Link icon

      public Date getDate(String key, Date defaultValue, String format)
      Gets a Date associated with the given configuration key. If the property is a String, it will be parsed with the specified format pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Date.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Date.
    • getDate Link icon

      public Date getDate(String key, String format)
      Gets a Date associated with the given configuration key. If the property is a String, it will be parsed with the specified format pattern.
      Parameters:
      key - The configuration key.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Date
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Date.
    • getDateArray Link icon

      public Date[] getDateArray(String key)
      Gets an array of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Date array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateArray Link icon

      public Date[] getDateArray(String key, Date... defaultValue)
      Gets an array of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated Date array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateArray Link icon

      public Date[] getDateArray(String key, Date[] defaultValue, String format)
      Gets an array of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Date array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateArray Link icon

      public Date[] getDateArray(String key, String format)
      Gets an array of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Date array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateList Link icon

      public List<Date> getDateList(String key)
      Gets a list of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object, a new list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Date list if the key is found. If the key doesn't map to an existing object, a new list is returned.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateList Link icon

      public List<Date> getDateList(String key, List<Date> defaultValue)
      Gets a list of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the format defined by the user in the DATE_FORMAT_KEY property, or if it's not defined with the DEFAULT_DATE_FORMAT pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated Date list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateList Link icon

      public List<Date> getDateList(String key, List<Date> defaultValue, String format)
      Gets a list of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Date list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDateList Link icon

      public List<Date> getDateList(String key, String format)
      Gets a list of Dates associated with the given configuration key. If the property is a list of Strings, they will be parsed with the specified format pattern. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      format - The non-localized DateFormat pattern.
      Returns:
      The associated Date list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Dates.
    • getDoubleArray Link icon

      public double[] getDoubleArray(String key)
      Gets an array of double primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated double array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of doubles.
    • getDoubleArray Link icon

      public double[] getDoubleArray(String key, double... defaultValue)
      Gets an array of double primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated double array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of doubles.
    • getDoubleList Link icon

      Gets a list of Double objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Double list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of doubles.
    • getDoubleList Link icon

      public List<Double> getDoubleList(String key, List<Double> defaultValue)
      Gets a list of Double objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Doubles.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of doubles.
    • getFloatArray Link icon

      public float[] getFloatArray(String key)
      Gets an array of float primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated float array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of floats.
    • getFloatArray Link icon

      public float[] getFloatArray(String key, float... defaultValue)
      Gets an array of float primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated float array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of floats.
    • getFloatList Link icon

      public List<Float> getFloatList(String key)
      Gets a list of Float objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Float list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of floats.
    • getFloatList Link icon

      public List<Float> getFloatList(String key, List<Float> defaultValue)
      Gets a list of Float objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Floats.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of floats.
    • getIntArray Link icon

      public int[] getIntArray(String key)
      Gets an array of int primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated int array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of integers.
    • getIntArray Link icon

      public int[] getIntArray(String key, int... defaultValue)
      Gets an array of int primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated int array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of integers.
    • getIntegerList Link icon

      Gets a list of Integer objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Integer list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of integers.
    • getIntegerList Link icon

      public List<Integer> getIntegerList(String key, List<Integer> defaultValue)
      Gets a list of Integer objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Integers.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of integers.
    • getKeysInternal Link icon

      Description copied from class: AbstractConfiguration
      Actually creates an iterator for iterating over the keys in this configuration. This method is called by getKeys(), it has to be defined by concrete subclasses.
      Specified by:
      getKeysInternal in class AbstractConfiguration
      Returns:
      an Iterator with all property keys in this configuration
    • getLocale Link icon

      public Locale getLocale(String key)
      Gets a Locale associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Locale.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Locale.
    • getLocale Link icon

      public Locale getLocale(String key, Locale defaultValue)
      Gets a Locale associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated Locale.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a Locale.
    • getLocaleArray Link icon

      public Locale[] getLocaleArray(String key)
      Gets an array of Locales associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Locale array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Locales.
    • getLocaleArray Link icon

      public Locale[] getLocaleArray(String key, Locale... defaultValue)
      Gets an array of Locales associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated Locale array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Locales.
    • getLocaleList Link icon

      Gets a list of Locales associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Locale list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Locales.
    • getLocaleList Link icon

      public List<Locale> getLocaleList(String key, List<Locale> defaultValue)
      Gets a list of Locales associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Locales.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of Locales.
    • getLongArray Link icon

      public long[] getLongArray(String key)
      Gets an array of long primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated long array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of longs.
    • getLongArray Link icon

      public long[] getLongArray(String key, long... defaultValue)
      Gets an array of long primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated long array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of longs.
    • getLongList Link icon

      public List<Long> getLongList(String key)
      Gets a list of Long objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Long list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of longs.
    • getLongList Link icon

      public List<Long> getLongList(String key, List<Long> defaultValue)
      Gets a list of Long objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Longs.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of longs.
    • getPropertyInternal Link icon

      Description copied from class: AbstractConfiguration
      Actually obtains the value of the specified property. This method is called by getProperty(). Concrete subclasses must define it to fetch the value of the desired property.
      Specified by:
      getPropertyInternal in class AbstractConfiguration
      Parameters:
      key - the key of the property in question
      Returns:
      the (raw) value of this property
    • getShortArray Link icon

      public short[] getShortArray(String key)
      Gets an array of short primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated short array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of shorts.
    • getShortArray Link icon

      public short[] getShortArray(String key, short... defaultValue)
      Gets an array of short primitives associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated short array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of shorts.
    • getShortList Link icon

      public List<Short> getShortList(String key)
      Gets a list of Short objects associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated Short list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of shorts.
    • getShortList Link icon

      public List<Short> getShortList(String key, List<Short> defaultValue)
      Gets a list of Short objects associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of Shorts.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of shorts.
    • getURI Link icon

      public URI getURI(String key)
      Gets an URI associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated URI.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not an URI.
    • getURI Link icon

      public URI getURI(String key, URI defaultValue)
      Gets an URI associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated URI.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not an URI.
    • getURIArray Link icon

      public URI[] getURIArray(String key)
      Gets an array of URIs associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated URI array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URIs.
    • getURIArray Link icon

      public URI[] getURIArray(String key, URI... defaultValue)
      Gets an array of URIs associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated URI array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URIs.
    • getURIList Link icon

      public List<URI> getURIList(String key)
      Gets a list of URIs associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated URI list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URIs.
    • getURIList Link icon

      public List<URI> getURIList(String key, List<URI> defaultValue)
      Gets a list of URIs associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of URIs.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URIs.
    • getURL Link icon

      public URL getURL(String key)
      Gets an URL associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated URL.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not an URL.
    • getURL Link icon

      public URL getURL(String key, URL defaultValue)
      Gets an URL associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated URL.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not an URL.
    • getURLArray Link icon

      public URL[] getURLArray(String key)
      Gets an array of URLs associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated URL array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URLs.
    • getURLArray Link icon

      public URL[] getURLArray(String key, URL... defaultValue)
      Gets an array of URLs associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key.
      defaultValue - the default value, which will be returned if the property is not found
      Returns:
      The associated URL array if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URLs.
    • getURLList Link icon

      public List<URL> getURLList(String key)
      Gets a list of URLs associated with the given configuration key. If the key doesn't map to an existing object an empty list is returned.
      Parameters:
      key - The configuration key.
      Returns:
      The associated URL list if the key is found.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URLs.
    • getURLList Link icon

      public List<URL> getURLList(String key, List<URL> defaultValue)
      Gets a list of URLs associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.
      Parameters:
      key - The configuration key.
      defaultValue - The default value.
      Returns:
      The associated List of URLs.
      Throws:
      ConversionException - is thrown if the key maps to an object that is not a list of URLs.
    • isEmptyInternal Link icon

      protected boolean isEmptyInternal()
      Description copied from class: AbstractConfiguration
      Actually checks whether this configuration contains data. This method is called by isEmpty(). It has to be defined by concrete subclasses.
      Specified by:
      isEmptyInternal in class AbstractConfiguration
      Returns:
      true if this configuration contains no data, false otherwise
    • setPropertyInternal Link icon

      protected void setPropertyInternal(String key, Object value)
      Description copied from class: AbstractConfiguration
      Actually sets the value of a property. This method is called by setProperty(). It provides a default implementation of this functionality by clearing the specified key and delegating to addProperty(). Subclasses should override this method if they can provide a more efficient algorithm for setting a property value.
      Overrides:
      setPropertyInternal in class AbstractConfiguration
      Parameters:
      key - the property key
      value - the new property value