Class OrderedProperties

java.lang.Object
com.jsql.view.swing.dialog.translate.OrderedProperties

public final class OrderedProperties extends Object
This class provides an alternative to the JDK's Properties class. It fixes the design flaw of using inheritance over composition, while keeping up the same APIs as the original class. Keys and values are guaranteed to be of type String.

This class is not synchronized, contrary to the original implementation.

As additional functionality, this class keeps its properties in a well-defined order. By default, the order is the one in which the individual properties have been added, either through explicit API calls or through reading them top-to-bottom from a properties file.

Also, an optional flag can be set to omit the comment that contains the current date when storing the properties to a properties file.

Currently, this class does not support the concept of default properties, contrary to the original implementation.

Note that this implementation is not synchronized. If multiple threads access ordered properties concurrently, and at least one of the threads modifies the ordered properties structurally, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the properties.

Note that the actual (and quite complex) logic of parsing and storing properties from and to a stream is delegated to the Properties class from the JDK.

See Also: