org.loom.binding
Class PropertyBinder

java.lang.Object
  extended by org.loom.binding.PropertyBinder

public class PropertyBinder
extends java.lang.Object

A binder for a nested property, e.g. address.street.name.


Constructor Summary
PropertyBinder(java.lang.String propertyPath)
           
 
Method Summary
 void applyValidation(java.lang.Object container, PropertyValidator validator, Messages messages)
          Applies a validation.
 void applyValidation(java.lang.Object container, ValidationRequest request)
           
 Converter getConverter()
           
 Node getLeafNode()
           
 java.lang.String getNormalizedPropertyPath()
           
 java.lang.Class<?> getPropertyClass()
           
 Node getRootNode()
           
 java.lang.Object getValue(java.lang.Object rootContainer, java.lang.String propertyPath)
          Gets the value on the given path
 java.lang.String getValueAsText(java.lang.Object rootContainer, java.lang.String propertyPath, MessagesRepository repository)
           
 void setConverter(Converter converter)
           
 void setRootNode(Node rootNode)
           
 void setValue(java.lang.Object rootContainer, java.lang.String propertyPath, java.lang.Object valueAsObject)
           
 void setValue(java.lang.Object rootContainer, java.lang.String paramName, java.lang.String paramValue, Messages messages, MessagesRepository repository)
          Assigns a value to the given path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyBinder

public PropertyBinder(java.lang.String propertyPath)
Method Detail

setValue

public void setValue(java.lang.Object rootContainer,
                     java.lang.String paramName,
                     java.lang.String paramValue,
                     Messages messages,
                     MessagesRepository repository)
Assigns a value to the given path

Parameters:
rootContainer - the object where to assign the value
paramValue - the value to assign

setValue

public void setValue(java.lang.Object rootContainer,
                     java.lang.String propertyPath,
                     java.lang.Object valueAsObject)

getValue

public java.lang.Object getValue(java.lang.Object rootContainer,
                                 java.lang.String propertyPath)
Gets the value on the given path

Parameters:
rootContainer - the root of the property path
propertyPath - the property path requested

getValueAsText

public java.lang.String getValueAsText(java.lang.Object rootContainer,
                                       java.lang.String propertyPath,
                                       MessagesRepository repository)

getRootNode

public Node getRootNode()

setRootNode

public void setRootNode(Node rootNode)

getNormalizedPropertyPath

public java.lang.String getNormalizedPropertyPath()

applyValidation

public void applyValidation(java.lang.Object container,
                            PropertyValidator validator,
                            Messages messages)
Applies a validation. If there is more than one value involved in this validation (i.e. lists, maps, or arrays), validates each and every node.

Parameters:
container - the action whose properties will be validated.
validator - The validator to be applied
messages - where to put any validation messages that may occur

applyValidation

public void applyValidation(java.lang.Object container,
                            ValidationRequest request)

getPropertyClass

public java.lang.Class<?> getPropertyClass()
Returns:
the property class of the end of this propertyPath

getLeafNode

public Node getLeafNode()

getConverter

public Converter getConverter()

setConverter

public void setConverter(Converter converter)