|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.util.property.Property
public abstract class Property
Definition and accessor for a property.
For example:
class MyProperties extends Properties {
public final IntegerProperty DebugLevel =
new IntegerProperty(this, "com.acme.debugLevel", 10);
}
MyProperties props = new MyProperties();
System.out.println(props.DebugLevel.get()); // prints "10", the default
props.DebugLevel.set(20);
System.out.println(props.DebugLevel.get()); // prints "20"
Nested Class Summary | |
---|---|
private static class |
Property.TriggerList
A trigger list a list of triggers associated with a given property. |
Field Summary | |
---|---|
private String |
defaultValue
|
private String |
path
|
protected Properties |
properties
|
private Property.TriggerList |
triggerList
List of triggers on this property. |
Constructor Summary | |
---|---|
protected |
Property(Properties properties,
String path,
String defaultValue)
Creates a Property and associates it with an underlying properties object. |
Method Summary | |
---|---|
void |
addTrigger(Trigger trigger)
Adds a trigger to this property. |
boolean |
booleanValue()
Returns the boolean value of this property. |
String |
getDefaultValue()
Returns the default value of this property. |
protected String |
getInternal(String defaultValue,
boolean required)
Retrieves the value of a property, using a given default value, and optionally failing if there is no value. |
String |
getPath()
Returns the name of this property. |
String |
getString()
Returns the value of this property as a string. |
boolean |
isSet()
Returns whether this property has a value assigned. |
void |
onChange(String oldValue,
String value)
Called when a property's value has just changed. |
void |
removeTrigger(Trigger trigger)
Removes a trigger from this property. |
String |
setString(String value)
Sets a property directly as a string. |
String |
stringValue()
Returns the value of the property as a string, or null if the property is not set. |
static boolean |
toBoolean(String value)
Converts a string to a boolean. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Properties properties
private final String path
private final String defaultValue
private final Property.TriggerList triggerList
Constructor Detail |
---|
protected Property(Properties properties, String path, String defaultValue)
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 |
---|
public String getPath()
public String getDefaultValue()
protected String getInternal(String defaultValue, boolean required)
public void addTrigger(Trigger trigger)
public void removeTrigger(Trigger trigger)
public void onChange(String oldValue, String value)
If one of the triggers on the property throws a Trigger.VetoRT
exception, this method passes
it on.
oldValue
- Previous value of the propertyvalue
- New value of the property
Trigger.VetoRT
- if one of the triggers
threw a VetoRTpublic String setString(String value)
public boolean isSet()
public String getString()
public boolean booleanValue()
public static boolean toBoolean(String value)
Boolean.parseBoolean(String)
is similar, but only
exists from JDK 1.5 onwards, and only accepts 'true'.
public String stringValue()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |