javax.beans.binding
Class ELPropertyResolver

java.lang.Object
  extended by javax.beans.binding.ELPropertyResolver

public final class ELPropertyResolver
extends java.lang.Object


Nested Class Summary
static class ELPropertyResolver.Delegate
          A Delegate is notified once a PropertyResolver is bound and a value of an observable property changes.
 
Constructor Summary
ELPropertyResolver(ELContext context)
           
ELPropertyResolver(ELContext context, java.lang.Object source, java.lang.String path)
           
 
Method Summary
 void bind()
          Attaches listeners on the objects along the path as described in the class documentation.
 Expression.Result evaluate()
          Evaluates the expression, returning the result.
 ELPropertyResolver.Delegate getDelegate()
          Returns the current delegate.
 Expression.Result.Type getEvaluationResultType()
          Returns the evaluation result type.
 java.lang.String getPath()
          Returns the path.
 java.lang.Object getSource()
          Returns the object the path is relative to.
 java.lang.Class<?> getTypeOfLastProperty()
          Returns the type of the last property.
 java.lang.Object getValueOfLastProperty()
          Returns the value of the last property identified in the path, relative to the source object.
 boolean isBound()
          Returns true if this resolver is bound.
 void setDelegate(ELPropertyResolver.Delegate delegate)
          Sets the delegate that is notified any time an observable property along the path changes.
 void setPath(java.lang.String path)
          Sets the path.
 void setSource(java.lang.Object source)
          Sets the object the path is relative to.
 void setValueOfLastProperty(java.lang.Object value)
          Sets the value of the last property identified in the path, relative to the source object.
 void unbind()
          Removes listeners installed from invoking bind.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ELPropertyResolver

public ELPropertyResolver(ELContext context)

ELPropertyResolver

public ELPropertyResolver(ELContext context,
                          java.lang.Object source,
                          java.lang.String path)
Method Detail

setSource

public void setSource(java.lang.Object source)
Sets the object the path is relative to.

Parameters:
source - the object the path is relative to
Throws:
java.lang.IllegalStateException - if bound

getSource

public java.lang.Object getSource()
Returns the object the path is relative to.

Returns:
the object the path is relative to

setPath

public void setPath(java.lang.String path)
Sets the path.

Parameters:
path - the path

getPath

public java.lang.String getPath()
Returns the path.

Returns:
the path

setDelegate

public void setDelegate(ELPropertyResolver.Delegate delegate)
Sets the delegate that is notified any time an observable property along the path changes.

Parameters:
delegate - the delegate
Throws:
java.lang.IllegalStateException - if the current delegate is non-null

getDelegate

public ELPropertyResolver.Delegate getDelegate()
Returns the current delegate.

Returns:
the current delegate

setValueOfLastProperty

public void setValueOfLastProperty(java.lang.Object value)
Sets the value of the last property identified in the path, relative to the source object. For example, if the current path is "firstName", this is equivalent to getSource().setFirstName(value) or getSource().put("firstName", value).

Parameters:
value - the value to set
Throws:
java.lang.IllegalStateException - if not bound, path is empty, or the current path is incomplete or the expression is read only
PropertyResolverException - as described in the class documentation

getValueOfLastProperty

public java.lang.Object getValueOfLastProperty()
Returns the value of the last property identified in the path, relative to the source object.

Returns:
the value
Throws:
java.lang.IllegalStateException - if not bound, or the expression is incomplete
PropertyResolverException - as described in the class documentation

getEvaluationResultType

public Expression.Result.Type getEvaluationResultType()
Returns the evaluation result type. This categorizes the state of evaluating the expression.

Returns:
true if all the values along the path resolve to a non-null value
Throws:
java.lang.IllegalStateException - if not bound, or the expression is incomplete
PropertyResolverException - as described in the class documentation

getTypeOfLastProperty

public java.lang.Class<?> getTypeOfLastProperty()
Returns the type of the last property.

Returns:
the type of the last property
Throws:
java.lang.IllegalStateException - if not all path elements are available
PropertyResolverException - if a property along the path can not be resolved

bind

public void bind()
Attaches listeners on the objects along the path as described in the class documentation. Any time a value along the path changes the delegate is notified.

Throws:
java.lang.IllegalStateException - if already bound, or the path is not empty and the source is null
PropertyResolverException - as described in the class documentation

unbind

public void unbind()
Removes listeners installed from invoking bind.

Throws:
java.lang.IllegalStateException - if not bound
PropertyResolverException - as described in the class documentation

evaluate

public Expression.Result evaluate()
Evaluates the expression, returning the result.

Returns:
the result of the evaluation

isBound

public boolean isBound()
Returns true if this resolver is bound.

Returns:
whether this resolver is bound