|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.millstone.base.data.util.ObjectProperty
A simple data object containing one typed value. This class is a
straightforward implementation of the the
Property
interface.
Nested Class Summary |
Nested classes inherited from class org.millstone.base.data.Property |
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeEvent, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeEvent, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
Constructor Summary | |
ObjectProperty(java.lang.Object value)
Creates a new instance of ObjectProperty with the given value. |
|
ObjectProperty(java.lang.Object value,
java.lang.Class type)
Creates a new instance of ObjectProperty with the given value and type. |
|
ObjectProperty(java.lang.Object value,
java.lang.Class type,
boolean readOnly)
Creates a new instance of ObjectProperty with the given value, type and read-only mode status. |
Method Summary | |
void |
addListener(Property.ReadOnlyStatusChangeListener listener)
Registers a new read-only status change listener for this Property. |
void |
addListener(Property.ValueChangeListener listener)
Registers a new value change listener for this ObjectProperty. |
java.lang.Class |
getType()
Returns the type of the ObjectProperty. |
java.lang.Object |
getValue()
Gets the value stored in the Property. |
boolean |
isReadOnly()
Tests if the Property is in read-only mode. |
void |
removeListener(Property.ReadOnlyStatusChangeListener listener)
Remove a previously registered read-only status change listener. |
void |
removeListener(Property.ValueChangeListener listener)
Remove a previously registered value change listener. |
void |
setReadOnly(boolean newStatus)
Sets the Property's read-only mode to the specified status. |
void |
setValue(java.lang.Object newValue)
Set the value of the property. |
java.lang.String |
toString()
Returns the value of the ObjectProperty in human readable textual format. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ObjectProperty(java.lang.Object value)
value
- Initial value of the Propertypublic ObjectProperty(java.lang.Object value, java.lang.Class type)
value
- Initial value of the Propertytype
- The type of the value. The value must be assignable to
given typepublic ObjectProperty(java.lang.Object value, java.lang.Class type, boolean readOnly)
value
- Initial value of the property.type
- The type of the value. value
must be
assignable to this type.readOnly
- Sets the read-only mode.Method Detail |
public final java.lang.Class getType()
getValue
and setValue
must be compatible
with this type: one must be able to safely cast the value returned
from getValue
to the given type and pass any variable
assignable to this type as an argument to setValue
.
getType
in interface Property
public java.lang.Object getValue()
getValue
in interface Property
public java.lang.String toString()
setValue
method if the Property is not in read-only
mode.
toString
in interface Property
toString
in class java.lang.Object
String
representation of the value stored in the
ObjectPropertypublic boolean isReadOnly()
setValue
will throw
ReadOnlyException
s and will not modify the value of the
Property.
isReadOnly
in interface Property
true
if the Property is in read-only mode,
false
if it's notpublic void setReadOnly(boolean newStatus)
setReadOnly
in interface Property
newStatus
- new read-only status of the Propertypublic void setValue(java.lang.Object newValue) throws Property.ReadOnlyException, Property.ConversionException
String
s if either String
is directly
assignable to property type, or the type class contains a string
constructor.
setValue
in interface Property
newValue
- New value of the property.
Property.ReadOnlyException
- if the object is in
read-only mode
Property.ConversionException
- if
newValue
can't be converted into the Property's native
type directly or through String
Property.ConversionException
- if newValue
can't
be converted into the Property's native type directly or through
String
Property.ReadOnlyException
- if the object is in read-only
modepublic void removeListener(Property.ValueChangeListener listener)
removeListener
in interface Property.ValueChangeNotifier
listener
- listener to be removedpublic void addListener(Property.ValueChangeListener listener)
addListener
in interface Property.ValueChangeNotifier
listener
- the new Listener to be registeredpublic void addListener(Property.ReadOnlyStatusChangeListener listener)
addListener
in interface Property.ReadOnlyStatusChangeNotifier
listener
- the new Listener to be registeredpublic void removeListener(Property.ReadOnlyStatusChangeListener listener)
removeListener
in interface Property.ReadOnlyStatusChangeNotifier
listener
- listener to be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |