Class AbstractTypedProperties

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
Direct Known Subclasses:
TypedProperties

public abstract class AbstractTypedProperties extends Properties
Extension of the java.util.Properties class to handle the conversion of string values to other types.
Since:
6.0
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • AbstractTypedProperties

      public AbstractTypedProperties()
      Default constructor.
    • AbstractTypedProperties

      public AbstractTypedProperties(Map<?,?> map)
      Initialize this object with a set of existing properties. This will copy into the present object all map entries such that both key and value are strings.
      Parameters:
      map - the properties to be copied. No reference to this parameter is kept in this TypedProperties object.
  • Method Details

    • loadAndResolve

      public <T extends AbstractTypedProperties> T loadAndResolve(Reader reader) throws IOException
      Load the properties from the specified reader. The properties are first loaded, then includes are resolved, variable substitutions are resolved, and finally scripted values are computed.
      Type Parameters:
      T - the type of object returned by this method.
      Parameters:
      reader - the reader to read the properties from.
      Returns:
      this TypedProperties object.
      Throws:
      IOException - if any error occurs.
    • asString

      public String asString()
      Convert this set of properties into a string.
      Returns:
      a representation of this object as a string.
    • asString

      public String asString(String delimiter)
      Convert this set of properties into a string.
      Parameters:
      delimiter - the delimiter between two properties definitions.
      Returns:
      a representation of this object as a string.
    • fromString

      public <T extends AbstractTypedProperties> T fromString(String source)
      Populate this propertis object from a string source.
      Type Parameters:
      T - the type of object returned by this method.
      Parameters:
      source - the source to read the properties from.
      Returns:
      this properties object.
    • fromString

      public <T extends AbstractTypedProperties> T fromString(String source, String delimiter)
      Populate this properties object from a string source.
      Type Parameters:
      T - the type of object returned by this method.
      Parameters:
      source - the source to read the properties from.
      delimiter - the delimiter between two properties definitions.
      Returns:
      this properties object.
    • getDefaults

      public AbstractTypedProperties getDefaults()
      Returns:
      the default (initial) properties, if any.
    • setDefaults

      public void setDefaults(AbstractTypedProperties defaults)
      Parameters:
      defaults - the default (initial) properties, if any.
    • reset

      public void reset()
    • toString

      public String toString()
      Overrides:
      toString in class Properties