## 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:
  PropertyEditorRegistry, TypeConverter

    public class GrailsDataBinder

extends 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

Field Summary
`protected BeanWrapper` `bean`
`static String[]` `DOMAINCLASS_DISALLOWED`
`static String[]` `GROOVY_DISALLOWED`
`static String[]` `GROOVY_DOMAINCLASS_DISALLOWED`
`static String` `NULL_ASSOCIATION`

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(Object target, String objectName)` Create a new GrailsDataBinder instance.

Method Summary
`protected void` `autoCreateIfPossible(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(PropertyValues propertyValues)`
`void` `bind(PropertyValues propertyValues, String prefix)`
`void` `bind(ServletRequest request)`
`void` `bind(ServletRequest request, String prefix)`
`protected void` `bindAssociations(MutablePropertyValues mpvs)` Interrogates the specified properties looking for properites that represent associations to other classes (e.g., 'author.id').
`static GrailsDataBinder` `createBinder(Object target, String objectName)` Utility method for creating a GrailsDataBinder instance
`static GrailsDataBinder` `createBinder(Object target, String objectName, HttpServletRequest request)` Utility method for creating a GrailsDataBinder instance
`protected void` `doBind(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`

Field Detail

### bean

    protected BeanWrapper bean

### GROOVY_DISALLOWED

    public static final String[] GROOVY_DISALLOWED

### DOMAINCLASS_DISALLOWED

    public static final String[] DOMAINCLASS_DISALLOWED

### GROOVY_DOMAINCLASS_DISALLOWED

    public static final String[] GROOVY_DOMAINCLASS_DISALLOWED

### NULL_ASSOCIATION

    public static final String NULL_ASSOCIATION

See Also:
  Constant Field Values

Constructor Detail

### GrailsDataBinder

    public GrailsDataBinder(Object target,
                            String objectName)

  Create a new GrailsDataBinder instance.

  Parameters:
    `target` - target object to bind onto
    `objectName` - objectName of the target object

Method Detail

### createBinder

    public static GrailsDataBinder createBinder(Object target,
                                                String objectName,
                                                HttpServletRequest request)

  Utility method for creating a GrailsDataBinder instance

  Parameters:
    `target` - The target object to bind to
    `objectName` - The name of the object
    `request` - A request instance
  Returns:
    A GrailsDataBinder instance

### createBinder

    public static GrailsDataBinder createBinder(Object target,
                                                String objectName)

  Utility method for creating a GrailsDataBinder instance

  Parameters:
    `target` - The target object to bind to
    `objectName` - The name of the object
  Returns:
    A GrailsDataBinder instance

### bind

    public void bind(PropertyValues propertyValues)

  Overrides:
    `bind` in class `DataBinder`

### bind

    public void bind(GrailsParameterMap params)

  Binds from a GrailsParameterMap object

  Parameters:
    `params` - The GrailsParameterMap object

### bind

    public void bind(PropertyValues propertyValues,
                     String prefix)

### bind

    public void bind(ServletRequest request)

  Overrides:
    `bind` in class `ServletRequestDataBinder`

### bind

    public void bind(ServletRequest request,
                     String prefix)

### doBind

    protected void doBind(MutablePropertyValues mpvs)

  Overrides:
    `doBind` in class `WebDataBinder`

### autoCreateIfPossible

    protected void autoCreateIfPossible(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(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-2009 The Grails project