org.eigenbase.util.property
Class PersistentStringProperty

java.lang.Object
  extended by org.eigenbase.util.property.Property
      extended by org.eigenbase.util.property.StringProperty
          extended by org.eigenbase.util.property.PersistentStringProperty

public class PersistentStringProperty
extends StringProperty

Definition and accessor for a string property that is capable of storing itself in a .properties file.

Since:
December 3, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/property/PersistentStringProperty.java#13 $
Author:
Stephan Zuercher

Field Summary
private  StringProperty propertyFileLocation
           
private  PersistentPropertyStorage storage
           
private  boolean storageInitialized
           
private static Logger tracer
           
 
Fields inherited from class org.eigenbase.util.property.Property
properties
 
Constructor Summary
PersistentStringProperty(Properties properties, String path, String defaultValue, StringProperty propertyFileLocation)
          Creates a persistent string property.
 
Method Summary
 String set(String value)
          Sets the value of this property.
 
Methods inherited from class org.eigenbase.util.property.StringProperty
get, get, get
 
Methods inherited from class org.eigenbase.util.property.Property
addTrigger, booleanValue, getDefaultValue, getInternal, getPath, getString, isSet, onChange, removeTrigger, setString, stringValue, toBoolean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tracer

private static final Logger tracer

propertyFileLocation

private StringProperty propertyFileLocation

storage

private PersistentPropertyStorage storage

storageInitialized

private boolean storageInitialized
Constructor Detail

PersistentStringProperty

public PersistentStringProperty(Properties properties,
                                String path,
                                String defaultValue,
                                StringProperty propertyFileLocation)
Creates a persistent string property.

Parameters:
properties - Properties object which holds values for this property.
path - Name by which this property is serialized to a properties file, for example "com.acme.trace.Verbosity".
defaultValue - Default value, null if there is no default.
propertyFileLocation - Location of the property file where this property's value should be persisted.
Method Detail

set

public String set(String value)
Sets the value of this property.

This method is synchronized to prevent multiple threads from attempting to initialize the property storage (storage) simultaneously.

Overrides:
set in class StringProperty
Returns:
The previous value, or the default value if not set.