org.codehaus.groovy.grails.web.binding
Class GrailsDataBinder
java.lang.Object
org.springframework.validation.DataBinder
org.springframework.web.bind.WebDataBinder
org.springframework.web.bind.ServletRequestDataBinder
org.codehaus.groovy.grails.web.binding.GrailsDataBinder
All Implemented Interfaces: org.springframework.beans.PropertyEditorRegistry, org.springframework.beans.TypeConverter
public class GrailsDataBinder extends org.springframework.web.bind.ServletRequestDataBinder
A data binder that handles binding dates that are specified with a "struct"-like syntax in request parameters.
For example for a set of fields defined as:
This would set the property "myDate" of type java.util.Date with the specified values.
Since:
05-Jan-2006
Author:
Graeme Rocher
Fields inherited from class org.springframework.web.bind.WebDataBinder
DEFAULT_FIELD_MARKER_PREFIX
Fields inherited from class org.springframework.validation.DataBinder
DEFAULT_OBJECT_NAME, logger
Constructor Summary
GrailsDataBinder (java.lang.Object target,
java.lang.String objectName)
Create a new GrailsDataBinder instance.
Method Summary
protected void
autoCreateIfPossible (org.springframework.beans.MutablePropertyValues mpvs)
Method that auto-creates the a type if it is null and is possible to auto-create
void
bind (GrailsParameterMap params)
Binds from a GrailsParameterMap object
void
bind (org.springframework.beans.PropertyValues propertyValues)
void
bind (org.springframework.beans.PropertyValues propertyValues,
java.lang.String prefix)
void
bind (javax.servlet.ServletRequest request)
void
bind (javax.servlet.ServletRequest request,
java.lang.String prefix)
protected void
bindAssociations (org.springframework.beans.MutablePropertyValues mpvs)
Interrogates the specified properties looking for properites that represent associations to other
classes (e.g., 'author.id').
static GrailsDataBinder
createBinder (java.lang.Object target,
java.lang.String objectName)
Utility method for creating a GrailsDataBinder instance
static GrailsDataBinder
createBinder (java.lang.Object target,
java.lang.String objectName,
javax.servlet.http.HttpServletRequest request)
Utility method for creating a GrailsDataBinder instance
protected void
doBind (org.springframework.beans.MutablePropertyValues mpvs)
Methods inherited from class org.springframework.web.bind.ServletRequestDataBinder
closeNoCatch
Methods inherited from class org.springframework.web.bind.WebDataBinder
bindMultipartFiles, checkFieldMarkers, getEmptyValue, getFieldMarkerPrefix, isBindEmptyMultipartFiles, setBindEmptyMultipartFiles, setFieldMarkerPrefix
Methods inherited from class org.springframework.validation.DataBinder
applyPropertyValues, checkAllowedFields, checkRequiredFields, close, convertIfNecessary, convertIfNecessary, findCustomEditor, getAllowedFields, getBindingErrorProcessor, getBindingResult, getDisallowedFields, getErrors, getInternalBindingResult, getObjectName, getPropertyAccessor, getPropertyEditorRegistry, getRequiredFields, getSimpleTypeConverter, getTarget, getTypeConverter, initBeanPropertyAccess, initDirectFieldAccess, isAllowed, isIgnoreInvalidFields, isIgnoreUnknownFields, registerCustomEditor, registerCustomEditor, setAllowedFields, setBindingErrorProcessor, setDisallowedFields, setExtractOldValueForEditor, setIgnoreInvalidFields, setIgnoreUnknownFields, setMessageCodesResolver, setRequiredFields
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bean
protected org.springframework.beans.ConfigurablePropertyAccessor bean
GROOVY_DISALLOWED
public static final java.lang.String[] GROOVY_DISALLOWED
DOMAINCLASS_DISALLOWED
public static final java.lang.String[] DOMAINCLASS_DISALLOWED
GROOVY_DOMAINCLASS_DISALLOWED
public static final java.lang.String[] GROOVY_DOMAINCLASS_DISALLOWED
NULL_ASSOCIATION
public static final java.lang.String NULL_ASSOCIATION
See Also: Constant Field Values
GrailsDataBinder
public GrailsDataBinder (java.lang.Object target,
java.lang.String objectName)
Create a new GrailsDataBinder instance.
Parameters: target
- target object to bind ontoobjectName
- objectName of the target object
createBinder
public static GrailsDataBinder createBinder (java.lang.Object target,
java.lang.String objectName,
javax.servlet.http.HttpServletRequest request)
Utility method for creating a GrailsDataBinder instance
Parameters: target
- The target object to bind toobjectName
- The name of the objectrequest
- A request instance
Returns: A GrailsDataBinder instance
createBinder
public static GrailsDataBinder createBinder (java.lang.Object target,
java.lang.String objectName)
Utility method for creating a GrailsDataBinder instance
Parameters: target
- The target object to bind toobjectName
- The name of the object
Returns: A GrailsDataBinder instance
bind
public void bind (org.springframework.beans.PropertyValues propertyValues)
Overrides: bind
in class org.springframework.validation.DataBinder
bind
public void bind (GrailsParameterMap params)
Binds from a GrailsParameterMap object
Parameters: params
- The GrailsParameterMap object
bind
public void bind (org.springframework.beans.PropertyValues propertyValues,
java.lang.String prefix)
bind
public void bind (javax.servlet.ServletRequest request)
Overrides: bind
in class org.springframework.web.bind.ServletRequestDataBinder
bind
public void bind (javax.servlet.ServletRequest request,
java.lang.String prefix)
doBind
protected void doBind (org.springframework.beans.MutablePropertyValues mpvs)
Overrides: doBind
in class org.springframework.web.bind.WebDataBinder
autoCreateIfPossible
protected void autoCreateIfPossible (org.springframework.beans.MutablePropertyValues mpvs)
Method that auto-creates the a type if it is null and is possible to auto-create
Parameters: mpvs
- A MutablePropertyValues instance
bindAssociations
protected void bindAssociations (org.springframework.beans.MutablePropertyValues mpvs)
Interrogates the specified properties looking for properites that represent associations to other
classes (e.g., 'author.id'). If such a property is found, this method attempts to load the specified
instance of the association (by ID) and set it on the target object.
Parameters: mpvs
- the MutablePropertyValues
object holding the parameters from the request
Copyright (c) 2005-2006 The Grails project