org.loom.binding
Class PropertyBinderMap

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

public class PropertyBinderMap
extends java.lang.Object

A map that handles a group of PropertyBinder together This class is thread safe


Field Summary
protected  java.util.Set<java.lang.String> unboundParameters
          the list of parameters that are not properties and should not be bound if found.
 
Constructor Summary
PropertyBinderMap()
           
 
Method Summary
 java.util.Map<java.lang.String,PropertyBinder> getBinders()
           
 java.lang.Class<?> getContainerClass()
           
 PropertyBinder getPropertyBinder(java.lang.String normalizedPropertyPath)
          Asks for the PropertyBinding instance corresponding to a given propertyPath.
 java.lang.Class<?> getPropertyClass(java.lang.String normalizedPropertyPath)
           
 PropertyBinder getRequiredPropertyBinder(java.lang.String normalizedPropertyPath)
          Same as getPropertyBinder, but the property is required to exist and will throw an exception if it does not.
 java.util.Set<java.lang.String> getUnboundParameters()
           
 java.lang.Object getValue(java.lang.Object container, java.lang.String propertyPath)
           
 java.lang.String getValueAsText(java.lang.Object container, java.lang.String propertyPath, MessagesRepository repository)
           
 void populate(Action action, ServletRequestParameters parameters, MessagesRepository messagesRepository, Messages messages)
          Applies the given values to the object passed as argument.
 void setContainerClass(java.lang.Class<?> containerClass)
           
 void setPropertyBinderFactory(PropertyBinderFactory propertyBinderFactory)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unboundParameters

protected java.util.Set<java.lang.String> unboundParameters
the list of parameters that are not properties and should not be bound if found. Once a property has been asked once and not found, it gets added to this set

Constructor Detail

PropertyBinderMap

public PropertyBinderMap()
Method Detail

getRequiredPropertyBinder

public PropertyBinder getRequiredPropertyBinder(java.lang.String normalizedPropertyPath)
Same as getPropertyBinder, but the property is required to exist and will throw an exception if it does not.


getPropertyBinder

public PropertyBinder getPropertyBinder(java.lang.String normalizedPropertyPath)
Asks for the PropertyBinding instance corresponding to a given propertyPath. If it exists, return it. If it does not yet exist, create and return it. If it cannot be created, register the propertyPath as unbound so it will not try to create it again in the future

Returns:
the corresponding PropertyBinding, null if none

getPropertyClass

public java.lang.Class<?> getPropertyClass(java.lang.String normalizedPropertyPath)
Returns:
the class of the specified property
Throws:
PropertyNotFoundException - if the property could not be found

populate

public void populate(Action action,
                     ServletRequestParameters parameters,
                     MessagesRepository messagesRepository,
                     Messages messages)
Applies the given values to the object passed as argument. This method accepts property values as Strings or FileItem (uploaded files)


size

public int size()

getValue

public java.lang.Object getValue(java.lang.Object container,
                                 java.lang.String propertyPath)
Returns:
the values for the specified path inside the container object

getValueAsText

public java.lang.String getValueAsText(java.lang.Object container,
                                       java.lang.String propertyPath,
                                       MessagesRepository repository)
Returns:
the values for the specified path inside the container object

setPropertyBinderFactory

public void setPropertyBinderFactory(PropertyBinderFactory propertyBinderFactory)

setContainerClass

public void setContainerClass(java.lang.Class<?> containerClass)

getBinders

public java.util.Map<java.lang.String,PropertyBinder> getBinders()

getUnboundParameters

public java.util.Set<java.lang.String> getUnboundParameters()

getContainerClass

public java.lang.Class<?> getContainerClass()