net.sf.echobinding.binding
Class AbstractPropertyAdapter

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

public abstract class AbstractPropertyAdapter
extends java.lang.Object
implements PropertyAdapter

See Also:
PropertyAdapter

Constructor Summary
AbstractPropertyAdapter()
           
 
Method Summary
 PropertyAdapter addValidator(Validator validator)
          Adds a validator to the list of validators.
protected  java.lang.Object format(java.lang.Object value)
           
 Decorator getDecorator()
          Returns the decorator.
 Format getFormat()
          Sets the format to be used by the getValue() method.
 java.lang.String getId()
          Returns the identifier of the adapter.
 java.lang.String getLabel()
          Returns the label for the adapter.
 BindingContext getSubContext()
          Returns the sub context.
 ValidationHandler getValidationHandler()
          Returns the validation handler.
 java.util.Set<Validator> getValidators()
           
protected  java.lang.Object parse(java.lang.Object value)
           
 PropertyAdapter setDecorator(Decorator decorator)
          Sets the decorator for this adapter.
 PropertyAdapter setFormat(Format format)
          Sets the format to be used by the getValue() method.
 PropertyAdapter setId(java.lang.String id)
          Sets the identifier for the adapter.
 PropertyAdapter setLabel(java.lang.String label)
          Sets the label.
 PropertyAdapter setSubContext(BindingContext context)
          Sets the sub context.
 PropertyAdapter setValidationHandler(ValidationHandler validationHandler)
          Sets the validation handler.
 PropertyAdapter setValidators(java.util.Set<Validator> validators)
          Sets the validators.
 ValidationReport validate(java.lang.Object bean, java.lang.Object value)
          Checks if the given value is valid for the specified bean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.echobinding.binding.PropertyAdapter
getValue, newInstance, setValue
 

Constructor Detail

AbstractPropertyAdapter

public AbstractPropertyAdapter()
Method Detail

format

protected java.lang.Object format(java.lang.Object value)

parse

protected java.lang.Object parse(java.lang.Object value)

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
Parameters:
bean - the bean
value - the value to validate
Returns:
the validation report
See Also:
ValidationReport

setValidators

public PropertyAdapter setValidators(java.util.Set<Validator> validators)
Description copied from interface: PropertyAdapter
Sets the validators. Validators are used to validate bean input. Each added Validator will be consulted when a bean input is checked by the validate(Obejct bean, Obejct value) method.

Specified by:
setValidators in interface PropertyAdapter
Parameters:
validators - the validators
Returns:
the property adapter
See Also:
Validator

addValidator

public PropertyAdapter addValidator(Validator validator)
Description copied from interface: PropertyAdapter
Adds a validator to the list of validators.

Specified by:
addValidator in interface PropertyAdapter
Returns:
See Also:
Validator

setFormat

public PropertyAdapter setFormat(Format format)
Description copied from interface: PropertyAdapter
Sets the format to be used by the getValue() method.

Specified by:
setFormat in interface PropertyAdapter
Parameters:
format - the format
Returns:
the adapter

setDecorator

public PropertyAdapter setDecorator(Decorator decorator)
Description copied from interface: PropertyAdapter
Sets the decorator for this adapter. A Decorator will be used in list components (SelectField, ListBox) to decorate the items in the list.

Specified by:
setDecorator in interface PropertyAdapter
Parameters:
decorator - the decorator
Returns:
the property adapter

getDecorator

public Decorator getDecorator()
Description copied from interface: PropertyAdapter
Returns the decorator.

Specified by:
getDecorator in interface PropertyAdapter
Returns:
the decorator

getLabel

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

Specified by:
getLabel in interface PropertyAdapter
Returns:
the label

setLabel

public PropertyAdapter setLabel(java.lang.String label)
Description copied from interface: PropertyAdapter
Sets the label. Labels are user in data bound tables for the column header names.

Specified by:
setLabel in interface PropertyAdapter
Parameters:
label - The label to set.
Returns:
the property adapter

getId

public java.lang.String getId()
Description copied from interface: PropertyAdapter
Returns the identifier of the adapter.

Specified by:
getId in interface PropertyAdapter
Returns:
the adapter's id

setId

public PropertyAdapter setId(java.lang.String id)
Description copied from interface: PropertyAdapter
Sets the identifier for the adapter. Generally you won't have to set the adapter id explicitly. Whenever you add/get an adapter to/from the binding context the there specified adapter id will be used as identfier.

Specified by:
setId in interface PropertyAdapter
Parameters:
id - the id
Returns:
the adapter

getFormat

public Format getFormat()
Description copied from interface: PropertyAdapter
Sets the format to be used by the getValue() method.

Specified by:
getFormat in interface PropertyAdapter
Returns:
the adapter

getValidators

public java.util.Set<Validator> getValidators()
Returns:
Returns the validator.

setValidationHandler

public PropertyAdapter setValidationHandler(ValidationHandler validationHandler)
Description copied from interface: PropertyAdapter
Sets the validation handler. A ValidationHanlder is used to report (validation) errors to the user.

Specified by:
setValidationHandler in interface PropertyAdapter
Parameters:
validationHandler - The validation handler
Returns:
the property adapter

getValidationHandler

public ValidationHandler getValidationHandler()
Description copied from interface: PropertyAdapter
Returns the validation handler.

Specified by:
getValidationHandler in interface PropertyAdapter
Returns:
the validation handler

setSubContext

public PropertyAdapter setSubContext(BindingContext context)
Description copied from interface: PropertyAdapter
Sets the sub context. In case your adapter wraps another bean or a collection of beans you may specify a sub context for this bean. Sub contexts are often used in data bound tables to resolve relationships between entities (e.g. one-to-many associations).

Specified by:
setSubContext in interface PropertyAdapter
Parameters:
context - The context to set
Returns:
the property adapter

getSubContext

public BindingContext getSubContext()
Description copied from interface: PropertyAdapter
Returns the sub context.

Specified by:
getSubContext in interface PropertyAdapter
Returns:
the sub context


Copyright © 2007. All Rights Reserved.