net.sf.echobinding.binding
Class OgnlPropertyAdapter

java.lang.Object
  extended by net.sf.echobinding.binding.AbstractPropertyAdapter
      extended by net.sf.echobinding.binding.OgnlPropertyAdapter
All Implemented Interfaces:
PropertyAdapter

public class OgnlPropertyAdapter
extends AbstractPropertyAdapter

This is an implemenation of the PropertyAdaper interface using OGNL expressions for accessing domain model properties.


Constructor Summary
OgnlPropertyAdapter(java.lang.String expression)
          Creates a new PropertyAdapter using OGNL expressions for accessing model properties.
 
Method Summary
 java.lang.String getExpression()
          Returns the OGNL expression.
 java.lang.String getLabel()
          Returns the label for the adapter.
 java.lang.String getOgnlContextName()
           
protected  java.lang.Object getParsedExpression()
           
 java.lang.Object getValue(java.lang.Object bean)
          Returns the value of the wrapped bean property.
 java.lang.Object getValue(ognl.OgnlContext context, java.lang.Object bean)
           
 PropertyAdapter newInstance()
          Creates a new adapter instance.
 void setExpression(java.lang.String expression)
          Sets the OGNL expression.
 void setValue(java.lang.Object bean, java.lang.Object value)
          Sets the value of the wrapped bean property.
 void setValue(ognl.OgnlContext context, java.lang.Object bean, java.lang.Object value)
          Sets the value.
 java.lang.String toString()
           
 ValidationReport validate(java.lang.Object bean, java.lang.Object value)
          Checks if the given value is valid for the specified bean.
 ValidationReport validateBean(java.lang.Object bean, java.lang.Object value)
          Validates a bean property by examing its annotated contraints.
 
Methods inherited from class net.sf.echobinding.binding.AbstractPropertyAdapter
addValidator, format, getDecorator, getFormat, getId, getSubContext, getValidationHandler, getValidators, parse, setDecorator, setFormat, setId, setLabel, setSubContext, setValidationHandler, setValidators
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OgnlPropertyAdapter

public OgnlPropertyAdapter(java.lang.String expression)
Creates a new PropertyAdapter using OGNL expressions for accessing model properties.

Parameters:
expression - The OGNL expression
Method Detail

setValue

public void setValue(java.lang.Object bean,
                     java.lang.Object value)
Description copied from interface: PropertyAdapter
Sets the value of the wrapped bean property.

Parameters:
bean - The bean
value - The value to set

getValue

public java.lang.Object getValue(java.lang.Object bean)
                          throws BindingException
Description copied from interface: PropertyAdapter
Returns the value of the wrapped bean property.

Parameters:
bean - the bean
Returns:
the value
Throws:
BindingException - If the value cannot be retrieved (eg. if the adapter is not applicable for the bean/property)

setValue

public void setValue(ognl.OgnlContext context,
                     java.lang.Object bean,
                     java.lang.Object value)
              throws BindingException
Sets the value.

Parameters:
context -
bean -
value -
Throws:
BindingException

getValue

public java.lang.Object getValue(ognl.OgnlContext context,
                                 java.lang.Object bean)
Parameters:
context -
bean -
Returns:

validateBean

public ValidationReport validateBean(java.lang.Object bean,
                                     java.lang.Object value)
Validates a bean property by examing its annotated contraints.

Parameters:
bean -
value -
Returns:
Throws:
ognl.OgnlException
See Also:
Validation Framework

validate

public ValidationReport validate(java.lang.Object bean,
                                 java.lang.Object value)
Description copied from interface: PropertyAdapter
Checks if the given value is valid for the specified bean. Returns a ValidationReport which tells you if the value is valid (ValidationReport.isValid()). The ValidationReport may also contain the error message (ValidationReport.getMessage()).

Specified by:
validate in interface PropertyAdapter
Overrides:
validate in class AbstractPropertyAdapter
Parameters:
bean - the bean
value - the value to validate
Returns:
the validation report
See Also:
ValidationReport

newInstance

public PropertyAdapter newInstance()
Description copied from interface: PropertyAdapter
Creates a new adapter instance. Clones the adapter. Will be used by the binding context to create child contexts.

Returns:
the property adapter

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getParsedExpression

protected java.lang.Object getParsedExpression()
Returns:
Returns the parsedExpression.

getExpression

public java.lang.String getExpression()
Returns the OGNL expression.

Returns:
The OGNL expression

setExpression

public void setExpression(java.lang.String expression)
Sets the OGNL expression.

Parameters:
the - OGNL expression

getLabel

public java.lang.String getLabel()
Description copied from interface: PropertyAdapter
Returns the label for the adapter.

Specified by:
getLabel in interface PropertyAdapter
Overrides:
getLabel in class AbstractPropertyAdapter
Returns:
the label

getOgnlContextName

public java.lang.String getOgnlContextName()
Returns:


Copyright © 2007. All Rights Reserved.