|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.primix.tapestry.binding.AbstractBinding | +--com.primix.tapestry.binding.PropertyBinding
Implements a dynamic binding, based on getting and fetching values using JavaBeans property access.
Constructor Summary | |
PropertyBinding(IComponent root,
java.lang.String propertyPath)
Creates a PropertyBinding from the root object
and a nested property name. |
Method Summary | |
java.lang.Object |
getObject()
Gets the value of the property path, with the assistance of a PropertyHelper . |
java.lang.String |
getPropertyPath()
|
IComponent |
getRoot()
|
java.lang.Class |
getType()
Follows the property path to determine the type. |
boolean |
isStatic()
Returns false. |
void |
setBoolean(boolean value)
Constructs a Boolean and invokes setObject(Object) . |
void |
setDouble(double value)
Constructs an Double and invokes setObject(Object) . |
void |
setInt(int value)
Constructs an Integer and invokes setObject(Object) . |
void |
setObject(java.lang.Object value)
Updates the property for the binding to the given value. |
void |
setString(java.lang.String value)
Invokes setObject(Object) . |
java.lang.String |
toString()
Returns the a String representing the property path. |
Methods inherited from class com.primix.tapestry.binding.AbstractBinding |
getBoolean, getDouble, getInt, getObject, getString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PropertyBinding(IComponent root, java.lang.String propertyPath)
PropertyBinding
from the root object
and a nested property name.
There's a lot of room for optimization here because we can
count on some portions of the nested property name to be
effectively static. Note that we type the root object as
IComponent
. We have some expectations that
certain properties of the root (and properties reachable from the root)
will be constant for the lifetime of the binding. For example,
components never change thier page or container. This means
that certain property prefixes can be optimized:
This means that once a PropertyBinding has been triggered,
the toString()
method may return different values for the root
component and the property path than was originally set.
Another option (much more involved) is to replace the
dynamic property access, which depends upon reflection (i.e.,
the Method
class), with dynamically generated
bytecodes. This has been done before, to create
dynamic adapter classes.
These operate orders-of-magnitude faster, though there is the question of building the bytecodes (non trivial!) and all the other classloader and security issues.
In the meantime, no optimization is done.
Method Detail |
public java.lang.String getPropertyPath()
public IComponent getRoot()
public java.lang.Object getObject()
PropertyHelper
.BindingException
- if an exception is thrown accessing the property.public boolean isStatic()
isStatic
in class AbstractBinding
public void setBoolean(boolean value)
IBinding
Boolean
and invokes IBinding.setObject(Object)
.setBoolean
in class AbstractBinding
com.primix.tapestry.binding.AbstractBinding
ReadOnlyBindingException
- always.public void setInt(int value)
IBinding
Integer
and invokes IBinding.setObject(Object)
.setInt
in class AbstractBinding
com.primix.tapestry.binding.AbstractBinding
ReadOnlyBindingException
- always.public void setDouble(double value)
IBinding
Double
and invokes IBinding.setObject(Object)
.setDouble
in class AbstractBinding
com.primix.tapestry.binding.AbstractBinding
ReadOnlyBindingException
- always.public void setString(java.lang.String value)
IBinding
IBinding.setObject(Object)
.setString
in class AbstractBinding
com.primix.tapestry.binding.AbstractBinding
ReadOnlyBindingException
- always.public void setObject(java.lang.Object value)
setObject
in class AbstractBinding
BindingException
- if the property can't be updated (typically
due to an security problem, or a missing mutator method).public java.lang.Class getType()
public java.lang.String toString()
extended id
of the root component
and the property path ... once the binding is used, these may change
due to optimization of the property path.toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |