org.eigenbase.util.property
Class BooleanProperty

java.lang.Object
  extended by org.eigenbase.util.property.Property
      extended by org.eigenbase.util.property.BooleanProperty

public class BooleanProperty
extends Property

Definition and accessor for a boolean property.

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

Field Summary
 
Fields inherited from class org.eigenbase.util.property.Property
properties
 
Constructor Summary
BooleanProperty(Properties properties, String path)
          Creates a Boolean property which has no default value.
BooleanProperty(Properties properties, String path, boolean defaultValue)
          Creates a Boolean property.
 
Method Summary
 boolean get()
          Retrieves the value of this boolean property.
 boolean get(boolean defaultValue)
          Retrieves the value of this boolean property.
 boolean set(boolean value)
          Sets the value of this boolean 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

BooleanProperty

public BooleanProperty(Properties properties,
                       String path,
                       boolean defaultValue)
Creates a Boolean 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.

BooleanProperty

public BooleanProperty(Properties properties,
                       String path)
Creates a Boolean property which has no default value.

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".
Method Detail

get

public boolean get()
Retrieves the value of this boolean property.

Returns true if the property exists, and its value is 1, true or yes; returns false otherwise.


get

public boolean get(boolean defaultValue)
Retrieves the value of this boolean property.

Returns true if the property exists, and its value is 1, true or yes; returns false otherwise.


set

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

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