Pattern - Java Properties File

Contents

Pattern - Java Properties File

The Java Properties file is effectively a derivative of the ini file pattern, a text file containing name=value definitions, one to a line.

Features

  • A flat list of name=value pairs
  • Encoding of non-ASCII values using \u0123 notation
  • #comments

Advantages

  • Easy to read/write in Java code using the java.util.Properties class.
  • Easy to read/write in Ant using the <properties> task.
  • Standard commenting and unicode representation rules

Disadvantages

  • Cross-referencing of values is non-standard. Some tools (e.g. Ant) do this, but not others. Even in Ant its behaviour is inconsistent.
  • The format is only 100% compatible with Java code. This leads to intermittent support calls to the Ant team "your task generates funny escape characters". "Yes it does, is the team's answer, as per the Java Properties class documentation".
  • No hierarchical data.

SmartFrog support

The propertyfile component, defined in /org/smartfrog/services/os/java/propertyfile.sf, takes the name of a property file, loads it, and stores the values as string tuples in the properties attribute, and set every individual value as attribute with the name given in the property key.

Get SmartFrog at SourceForge.net. Fast, secure and Free Open Source software downloads