|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.scopemvc.core.ModelManager | +--org.scopemvc.core.PropertyManager
PropertyManager is a ModelManager
that provides access to the
properties of model objects. An implementation for JavaBean model objects is
provided in org.scopemvc.model.beans.BeansPropertyManager.
Constructor Summary | |
PropertyManager()
|
Method Summary | |
abstract java.lang.Object |
get(java.lang.Object inModel,
Selector inSelector)
Return the value of the property identified by the passed Selector . |
static PropertyManager |
getInstance(java.lang.Class inModelClass)
Create an PropertyManager for the model class |
static PropertyManager |
getInstance(java.lang.Object inModel)
Create an PropertyManager for the model |
abstract java.lang.Class |
getPropertyClass(java.lang.Object inModel,
Selector inSelector)
Return the Class of a property. |
abstract Selector |
getSelectorFor(java.lang.Object inModel,
java.lang.Object inProperty)
Return a Selector that would get() a property equals() to the passed Object. |
abstract java.util.Iterator |
getSelectorIterator(java.lang.Object inModel)
Return an Iterator that iterates over Selectors for all properties of the passed model object. |
abstract boolean |
hasProperty(java.lang.Object inModel,
Selector inSelector)
Does the passed model object contain the property identified by the passed Selector? |
abstract boolean |
isReadOnly(java.lang.Object inModel,
Selector inSelector)
Is a property read-only? If the passed Selector is null then is the model object as a whole read-only? |
abstract void |
set(java.lang.Object inModel,
Selector inSelector,
java.lang.Object inValue)
Set the value of the property identified by a Selector in the
passed model object to a new value. |
Methods inherited from class org.scopemvc.core.ModelManager |
getModelClass, make |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PropertyManager()
Method Detail |
public static PropertyManager getInstance(java.lang.Class inModelClass)
inModelClass
- The model class
public static PropertyManager getInstance(java.lang.Object inModel)
inModel
- The model
public abstract java.lang.Object get(java.lang.Object inModel, Selector inSelector) throws java.lang.Exception
Return the value of the property identified by the passed Selector
. If the passed Selector is null, return the model object
itself.
inModel
- model to get property frominSelector
- identify the property to be returned or null for the
model object itself.
java.lang.Exception
- If the value of the property could not be retrievedpublic abstract boolean isReadOnly(java.lang.Object inModel, Selector inSelector) throws java.lang.Exception
Is a property read-only? If the passed Selector is null then is the model object as a whole read-only?
Enforcement of the access state must be implemented by the model itself.
inModel
- model object to test the property on.inSelector
- The property to test or null to test the whole model
object.
java.lang.Exception
- If the read-only state of the property could not be
testedpublic abstract java.lang.Class getPropertyClass(java.lang.Object inModel, Selector inSelector) throws java.lang.Exception
inModel
- model to test the property for.inSelector
- property to test.
java.lang.Exception
- If the class of the property could not be retrievedpublic abstract java.util.Iterator getSelectorIterator(java.lang.Object inModel)
Return an Iterator that iterates over Selectors for all properties of the passed model object.
inModel
- model to make an Iterator for.
public abstract Selector getSelectorFor(java.lang.Object inModel, java.lang.Object inProperty)
inProperty
- the property Object to find.inModel
- the model to get the property from.
public abstract void set(java.lang.Object inModel, Selector inSelector, java.lang.Object inValue) throws java.lang.Exception
Set the value of the property identified by a Selector
in the
passed model object to a new value.
The implementation should not set the value if the new value has the same Object reference as the original. It could also avoid setting the value if the new value is equivalent to the old value, and the value is of an immutable Class (like Integer, String). Otherwise the property must be set to the new value, even if it equals() the old value.
Usually, a ModelChangeEvent
for ModelChangeTypes.VALUE_CHANGED
should be broadcast by the model when the
property is set so that interested listeners know that the model's state
has changed.
If the property is a sub-model object then the parent model should be
registered as a ModelChangeListener
to be able to propagate
events properly. This propagation is partially implemented in BasicModel
but it relies on child Models being
listened to by their parent. (Note: deregister from the old Model then
register with the new one). See the sample code for examples using BasicModel.listenNewSubmodel(org.scopemvc.core.Selector)
and BasicModel.unlistenOldSubmodel(org.scopemvc.core.Selector)
.
inModel
- model to set the property on.inSelector
- identify the property to be set. Can't be null.inValue
- the value to set the property to.
java.lang.Exception
- if the value could not be set in the modelpublic abstract boolean hasProperty(java.lang.Object inModel, Selector inSelector)
inModel
- model to test the property for.inSelector
- property to test.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |