Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.web.binding
[Java] Class GrailsDataBinder

    java.lang.Object
      org.springframework.web.bind.ServletRequestDataBinder
          org.codehaus.groovy.grails.web.binding.GrailsDataBinder

    @SuppressWarnings("rawtypes")
    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.

Authors:
  Graeme Rocher

Field Summary
`static java.lang.String` | `DEFAULT_DATE_FORMAT`
`static String[]` | `DOMAINCLASS_DISALLOWED`
`static String[]` | `GROOVY_DISALLOWED`
`static String[]` | `GROOVY_DOMAINCLASS_DISALLOWED`
`static java.lang.String` | `NULL_ASSOCIATION`
`protected BeanWrapper` | `bean`

Constructor Summary
`GrailsDataBinder(java.lang.Object target, java.lang.String objectName)` Create a new GrailsDataBinder instance.

Method Summary
`protected void` | `autoCreateIfPossible(MutablePropertyValues mpvs)` Auto-creates the a type if it is null and is possible to auto-create.
`void` | `bind(PropertyValues propertyValues)`
`void` | `bind(GrailsParameterMap params)` Binds from a GrailsParameterMap object
`void` | `bind(GrailsParameterMap params, java.lang.String prefix)`
`void` | `bind(PropertyValues propertyValues, java.lang.String prefix)`
`void` | `bind(ServletRequest request)`
`void` | `bind(ServletRequest request, java.lang.String prefix)`
`protected void` | `bindAssociations(MutablePropertyValues mpvs)` Interrogates the specified properties looking for properites that represent associations to other classes (e.g., 'author.id').
`protected void` | `checkFieldMarkers(MutablePropertyValues mpvs)` This overrides the method from WebDataBinder to allow for nested checkbox handling, so property paths such as a.
`static GrailsDataBinder` | `createBinder(java.lang.Object target, java.lang.String objectName, HttpServletRequest request)` Utility method for creating a GrailsDataBinder instance
`static GrailsDataBinder` | `createBinder(java.lang.Object target, java.lang.String objectName)` Utility method for creating a GrailsDataBinder instance
`protected void` | `doBind(MutablePropertyValues mpvs)`
`static void` | `registerCustomEditors(PropertyEditorRegistry registry, java.util.Locale locale)` Registers all known

Field Detail

### DEFAULT_DATE_FORMAT

    public static final java.lang.String DEFAULT_DATE_FORMAT

### DOMAINCLASS_DISALLOWED

    public static final String[] DOMAINCLASS_DISALLOWED

### GROOVY_DISALLOWED

    public static final String[] GROOVY_DISALLOWED

### GROOVY_DOMAINCLASS_DISALLOWED

    public static final String[] GROOVY_DOMAINCLASS_DISALLOWED

### NULL_ASSOCIATION

    public static final java.lang.String NULL_ASSOCIATION

### bean

    protected BeanWrapper bean

Constructor Detail

### GrailsDataBinder

    @SuppressWarnings("unchecked")
    public GrailsDataBinder(java.lang.Object target, java.lang.String objectName)

  Create a new GrailsDataBinder instance.
  Parameters:
    `target` - target object to bind onto
    `objectName` - objectName of the target object

Method Detail

### autoCreateIfPossible

    protected void autoCreateIfPossible(MutablePropertyValues mpvs)

  Auto-creates the a type if it is null and is possible to auto-create.
  Parameters:
    `mpvs` - A MutablePropertyValues instance

### bind

    @Override
    public void bind(PropertyValues propertyValues)

### bind

    public void bind(GrailsParameterMap params)

  Binds from a GrailsParameterMap object
  Parameters:
    `params` - The GrailsParameterMap object

### bind

    public void bind(GrailsParameterMap params, java.lang.String prefix)

### bind

    public void bind(PropertyValues propertyValues, java.lang.String prefix)

### bind

    @Override
    public void bind(ServletRequest request)

### bind

    public void bind(ServletRequest request, java.lang.String prefix)

### 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

### checkFieldMarkers

    @Override
    protected void checkFieldMarkers(MutablePropertyValues mpvs)

  This overrides the method from WebDataBinder to allow for nested checkbox handling, so property paths such as a._b will result in the boolean b on object a getting set to false.

### createBinder

    public static GrailsDataBinder createBinder(java.lang.Object target, java.lang.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(java.lang.Object target, java.lang.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

### doBind

    @Override
    protected void doBind(MutablePropertyValues mpvs)

### registerCustomEditors

    public static void registerCustomEditors(PropertyEditorRegistry registry, java.util.Locale locale)

  Registers all known
  Parameters:
    registry
    locale

Groovy Documentation