org.eigenbase.util.property
Class StringProperty

java.lang.Object
  extended by org.eigenbase.util.property.Property
      extended by org.eigenbase.util.property.StringProperty
Direct Known Subclasses:
PersistentStringProperty

public class StringProperty
extends Property

Definition and accessor for a string property.

Since:
May 4, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/property/StringProperty.java#13 $
Author:
jhyde

Field Summary
 
Fields inherited from class org.eigenbase.util.property.Property
properties
 
Constructor Summary
StringProperty(Properties properties, String path, String defaultValue)
          Creates a string property.
 
Method Summary
 String get()
          Retrieves the value of this property.
 String get(boolean required)
          Retrieves the value of this property, optionally failing if there is no value.
 String get(String defaultValue)
          Retrieves the value of this property, or the default value if none is found.
 String set(String value)
          Sets the value of this property.
 
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
 

Constructor Detail

StringProperty

public StringProperty(Properties properties,
                      String path,
                      String defaultValue)
Creates a 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.
Method Detail

get

public String get()
Retrieves the value of this property. Returns the property's default value if the property set has no value for this property.


get

public String get(boolean required)
Retrieves the value of this property, optionally failing if there is no value. Returns the property's default value if the property set has no value for this property.


get

public String get(String defaultValue)
Retrieves the value of this property, or the default value if none is found.


set

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

Returns:
The previous value, or the default value if not set.