com.primix.tapestry
Interface IBinding

All Known Implementing Classes:
AbstractBinding

public interface IBinding

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).

Version:
$Id: IBinding.java,v 1.11 2001/08/23 20:19:32 hship Exp $
Author:
Howard Ship

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.
 java.lang.Object getObject()
          Returns the value of the Binding.
 java.lang.Object getObject(java.lang.String parameterName, java.lang.Class type)
          Returns the value for the binding after performing some basic checks.
 java.lang.String getString()
          Invokes getObject() and converts the result to java.lang.String.
 java.lang.Class getType()
          Returns the type of the binding.
 boolean isStatic()
          Returns true if the value is statically defined.
 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 value of the binding, if possible.
 void setString(java.lang.String value)
          Invokes setObject(Object).
 

Method Detail

getBoolean

public boolean getBoolean()
Invokes getObject(), then coerces the value to a boolean. The following rules are used to perform the coercion:

getInt

public int getInt()
Gets the value of the Binding using getObject() and coerces it to an int. Strings will be parsed, and other java.lang.Number classes will have intValue() invoked.
Throws:
ClassCastException - if the binding's value is not of a usable class.
NullValueForBindingException - if the binding's value is null.

getDouble

public double getDouble()
Gets the value of the Binding using getObject() and coerces it to a double. Strings will be parsed, and other java.lang.Number classes will have doubleValue() invoked.
Throws:
ClassCastException - if the binding's value is not of a usable class.
NullValueForBindingException - if the binding's value is null.

getString

public java.lang.String getString()
Invokes getObject() and converts the result to java.lang.String.

getObject

public java.lang.Object getObject()
Returns the value of the Binding. This is the essential method. Other methods get this value and cast or coerce the value.

getObject

public java.lang.Object getObject(java.lang.String parameterName,
                                  java.lang.Class type)
Returns the value for the binding after performing some basic checks.
Parameters:
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 class
Throws:
BindingException - if the value is not assignable to the specified type a
Since:
0.2.9

isStatic

public boolean isStatic()
Returns true if the value is statically defined. Static values are read-only.

setBoolean

public void setBoolean(boolean value)
Constructs a Boolean and invokes setObject(Object).

setInt

public void setInt(int value)
Constructs an Integer and invokes setObject(Object).

setDouble

public void setDouble(double value)
Constructs an Double and invokes setObject(Object).

setString

public void setString(java.lang.String value)
Invokes setObject(Object).

setObject

public void setObject(java.lang.Object value)
Updates the value of the binding, if possible.
Throws:
ReadOnlyBindingException - If the binding is read only.

getType

public java.lang.Class getType()
Returns the type of the binding. For static bindings, returns the actual type stored (this will be String for most static bindings, or the actual type of a field, for field bindings).
Since:
1.0.5