|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A binding is the mechanism used to provide values for parameters of
specific IComponent
instances. The component doesn't
care where the required value comes from, it simply requires that
a value be provided when needed.
Bindings are set inside the containing component's specification. Bindings may be static or dynamic (though that is irrelevant to the component). Components may also use a binding to write a value back through a property to some other object (typically, another component).
Method Summary | |
boolean |
getBoolean()
Invokes getObject() , then coerces the value to a boolean. |
double |
getDouble()
Gets the value of the Binding using getObject() and coerces it
to a double . |
int |
getInt()
Gets the value of the Binding using getObject() and coerces it
to an int . |
Object |
getObject()
Returns the value of this binding. |
Object |
getObject(String parameterName,
Class type)
Returns the value for the binding after performing some basic checks. |
String |
getString()
Invokes getObject() and converts the result to java.lang.String . |
boolean |
isInvariant()
Returns true if the value is invariant (not changing; the same value returned each time). |
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(Object value)
Updates the value of the binding, if possible. |
void |
setString(String value)
Invokes setObject(Object) . |
Methods inherited from interface org.apache.tapestry.ILocatable |
getLocation |
Method Detail |
public boolean getBoolean()
getObject()
, then coerces the value to a boolean.
The following rules are used to perform the coercion:
Boolean
value is self-evident
Number
value is true if non-zero
String
value is true if non-empty and contains
non-whitespace characters
Collection
value is true if it has a non-zero
size
Tapestry.evaluateBoolean(Object)
public int getInt()
getObject()
and coerces it
to an int
. Strings will be parsed, and other
java.lang.Number
classes will have intValue()
invoked.ClassCastException
- if the binding's value is not of a usable class.NullValueForBindingException
- if the binding's value is null.public double getDouble()
getObject()
and coerces it
to a double
. Strings will be parsed, and other
java.lang.Number
classes will have doubleValue()
invoked.ClassCastException
- if the binding's value is not of a usable class.NullValueForBindingException
- if the binding's value is null.public String getString()
getObject()
and converts the result to java.lang.String
.public Object getObject()
public Object getObject(String parameterName, Class type)
parameterName
- the name of the parameter (used to build
the message if an exception is thrown).type
- if not null, the value must be assignable to the specific
classBindingException
- if the value is not assignable to the
specified typepublic boolean isInvariant()
ExpressionBinding
s
may be marked invariant (as an optimization).public void setBoolean(boolean value)
Boolean
and invokes setObject(Object)
.public void setInt(int value)
Integer
and invokes setObject(Object)
.public void setDouble(double value)
Double
and invokes setObject(Object)
.public void setString(String value)
setObject(Object)
.public void setObject(Object value)
ReadOnlyBindingException
- If the binding is read only.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |