org.apache.tapestry.binding
Class ExpressionBinding

java.lang.Object
  extended by org.apache.tapestry.binding.AbstractBinding
      extended by org.apache.tapestry.binding.ExpressionBinding
All Implemented Interfaces:
org.apache.hivemind.Locatable, IBinding

public class ExpressionBinding
extends AbstractBinding

Implements a dynamic binding, based on evaluating an expression using an expression language. Tapestry's default expression language is the Object Graph Navigation Language .

Since:
2.2
Author:
Howard Lewis Ship
See Also:
ExpressionEvaluator

Field Summary
 
Fields inherited from class org.apache.tapestry.binding.AbstractBinding
_description
 
Constructor Summary
ExpressionBinding(String description, org.apache.hivemind.Location location, ValueConverter valueConverter, IComponent root, String expression, ExpressionEvaluator evaluator, ExpressionCache cache)
          Creates a ExpressionBinding from the root object and an OGNL expression.
 
Method Summary
 Object getComponent()
          Returns the component to which this binding is connected; this is currently only used when building certain exceptions.
 Object getObject()
          Gets the value of the property path, with the assistance of the ExpressionEvaluator.
 boolean isInvariant()
          Returns true if the binding is expected to always return the same value.
 void setObject(Object value)
          Updates the property for the binding to the given value.
 String toString()
          Returns the a String representing the property path.
 
Methods inherited from class org.apache.tapestry.binding.AbstractBinding
createReadOnlyBindingException, extendDescription, getDescription, getLocation, getObject, getValueConverter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionBinding

public ExpressionBinding(String description,
                         org.apache.hivemind.Location location,
                         ValueConverter valueConverter,
                         IComponent root,
                         String expression,
                         ExpressionEvaluator evaluator,
                         ExpressionCache cache)
Creates a ExpressionBinding from the root object and an OGNL expression.

Parameters:
description - Used by superclass constructor - AbstractBinding.AbstractBinding(String, org.apache.tapestry.coerce.ValueConverter, org.apache.hivemind.Location).
location - Used by superclass constructor - AbstractBinding.AbstractBinding(String, org.apache.tapestry.coerce.ValueConverter, org.apache.hivemind.Location).
valueConverter - Used by superclass constructor - AbstractBinding.AbstractBinding(String, org.apache.tapestry.coerce.ValueConverter, org.apache.hivemind.Location).
root - The object this binding should be resolved against.
expression - The string expression.
evaluator - Evaluator used to parse and run the expression.
cache - Expression cache which does efficient caching of parsed expressions.
Method Detail

getObject

public Object getObject()
Gets the value of the property path, with the assistance of the ExpressionEvaluator.

Throws:
BindingException - if an exception is thrown accessing the property.

isInvariant

public boolean isInvariant()
Returns true if the binding is expected to always return the same value.

Specified by:
isInvariant in interface IBinding
Overrides:
isInvariant in class AbstractBinding

setObject

public void setObject(Object value)
Updates the property for the binding to the given value.

Specified by:
setObject in interface IBinding
Overrides:
setObject in class AbstractBinding
Throws:
BindingException - if the property can't be updated (typically due to an security problem, or a missing mutator method).

toString

public String toString()
Returns the a String representing the property path. This includes the extended idof the root component and the property path ... once the binding is used, these may change due to optimization of the property path.

Overrides:
toString in class AbstractBinding

getComponent

public Object getComponent()
Description copied from class: AbstractBinding
Returns the component to which this binding is connected; this is currently only used when building certain exceptions. This implementation returns null.

Overrides:
getComponent in class AbstractBinding
Returns:
The IComponent object this binding is set against.
Since:
4.0


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.