|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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"
Field Summary | |
---|---|
protected java.util.Properties |
properties
|
Constructor Summary | |
---|---|
protected |
Property(java.util.Properties properties,
java.lang.String path,
java.lang.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. |
java.lang.String |
getDefaultValue()
Returns the default value of this property. |
protected java.lang.String |
getInternal(java.lang.String defaultValue,
boolean required)
Retrieves the value of a property, using a given default value, and optionally failing if there is no value. |
java.lang.String |
getPath()
|
java.lang.String |
getString()
Returns the value of this property as a string. |
boolean |
isSet()
Returns whether this property has a value assigned. |
void |
onChange(java.lang.String oldValue,
java.lang.String value)
Called when a property's value has just changed. |
void |
removeTrigger(Trigger trigger)
Removes a trigger from this property. |
java.lang.Object |
setString(java.lang.String value)
Sets a property directly as a string. |
java.lang.String |
stringValue()
Returns the value of the property as a string. |
protected static boolean |
toBoolean(java.lang.String value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.Properties properties
Constructor Detail |
---|
protected Property(java.util.Properties properties, java.lang.String path, java.lang.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 java.lang.String getPath()
public java.lang.String getDefaultValue()
protected java.lang.String getInternal(java.lang.String defaultValue, boolean required)
public void addTrigger(Trigger trigger)
public void removeTrigger(Trigger trigger)
public void onChange(java.lang.String oldValue, java.lang.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 java.lang.Object setString(java.lang.String value)
public boolean isSet()
public java.lang.String getString()
public boolean booleanValue()
protected static boolean toBoolean(java.lang.String value)
public java.lang.String stringValue()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |