|
Joda System API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Property defines the concept of a property on a Bean. This is the principal interface for properties. Applications will use generally use one of the type specific subinterfaces in their code, such as StringProperty or BooleanProperty.
A Property has the ability to be changed from modifiable to unmodifiable dynamically. This can provide a weak form of the const keyword in C.
A Property has methods to support event listeners. Events will be sent every time the value of the property is changed. Note that in order for this to work all updates must go through the methods on the Property object. When this is not the case, the event must be fired manually.
A Property contains a Map of String attributes. This map allows additional arbitrary data to be attached to any property. This corresponds to the XML attribute concept. One use for attributes is to attach an error code to the property which caused the error during validation.
Nested Class Summary | |
static interface |
Property.Internal
Interface used during the cloning process. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a listener to the list of those receiving change events. |
Bean |
bean()
Get the bean which owns this property. |
boolean |
equals(java.lang.Object anotherObject)
Is this property equal to another property. |
boolean |
equalsValue(java.lang.Object anotherObject)
Is this value of this property equal to another object. |
void |
firePropertyChange(java.lang.Object oldObject,
java.lang.Object newObject)
Fire a value changed event for the property. |
java.lang.String |
getContentName()
Get the effective name of the property. |
java.lang.Class |
getContentType()
Get the type of the objects contained in the property. |
java.lang.String |
getPropertyName()
Get the name of this property in its parent. |
java.lang.Class |
getPropertyType()
Get the type that this property is. |
int |
hashCode()
Get the hashCode for the property in line with the definition of equals() . |
boolean |
isModifiable()
Check whether the object can currently be modified. |
boolean |
isNull()
Test if the property currently set to null. |
boolean |
isReadOnly()
Check whether the object is permanently read only. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove the specified listener from the list currently receiving change events. |
void |
set(java.lang.Object propertyValue)
Set the property's value as an object. |
void |
setModifiable(boolean modifiable)
Set the flag to indicate if the object is currently modifiable. |
void |
setReadOnly()
Set the object to be permanently read only. |
java.lang.Object |
toObject()
Get the property's value as an object. |
java.lang.String |
toString()
Get a debugging string. |
Methods inherited from interface org.joda.property.ModelElement |
getAttribute, getAttributeCount, getAttributeMap, setAttribute |
Method Detail |
public Bean bean()
public java.lang.Object toObject()
This method has strong semantics such that where a and b are
properties of the same type, it must be true that:
b.set( a.toObject() );
a.equals(b);
In other words, the object contains all the data necessary to
recreate the property's value.
public boolean isNull()
public void set(java.lang.Object propertyValue)
If a String is passed in, it can be parsed in various ways. If the results of toDataString() are passed in, it must reconstitute the original value.
propertyValue
- an Object to set the property's value to
java.lang.IllegalArgumentException
- thrown if value unacceptablepublic boolean isReadOnly()
public void setReadOnly()
public boolean isModifiable()
public void setModifiable(boolean modifiable)
modifiable
- true if object should be modifiablepublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- a listener to add to the listpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- a listener to remove from the listpublic void firePropertyChange(java.lang.Object oldObject, java.lang.Object newObject)
public java.lang.String getPropertyName()
public java.lang.Class getPropertyType()
public java.lang.String getContentName()
public java.lang.Class getContentType()
public boolean equalsValue(java.lang.Object anotherObject)
equalsValue(null)
will return true.
For an IntegerProperty with the value 5:
property.equalsValue(new Integer(5)) == true
property.equalsValue(new Integer(3)) == false
property.equalsValue("5") == true
property.equalsValue("3") == false
property.equalsValue(new DateTime()) == false
anotherObject
- another object to compare this one to
public boolean equals(java.lang.Object anotherObject)
equals
in class java.lang.Object
anotherObject
- another object to compare this one to
public int hashCode()
equals()
.
hashCode
in class java.lang.Object
public java.lang.String toString()
toDataString()
where available.
toString
in class java.lang.Object
|
Joda System API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |