Groovy Documentation

org.codehaus.groovy.grails.web.binding
[Java] 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

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

Authors:
Graeme Rocher


Field Summary
static java.lang.String DEFAULT_DATE_FORMAT

static java.lang.String[] DOMAINCLASS_DISALLOWED

static java.lang.String[] GROOVY_DISALLOWED

static java.lang.String[] GROOVY_DOMAINCLASS_DISALLOWED

static java.lang.String NULL_ASSOCIATION

protected org.springframework.beans.BeanWrapper bean

 
Fields inherited from class org.springframework.web.bind.ServletRequestDataBinder
DEFAULT_FIELD_MARKER_PREFIX, DEFAULT_FIELD_DEFAULT_PREFIX, DEFAULT_OBJECT_NAME, DEFAULT_AUTO_GROW_COLLECTION_LIMIT
 
Fields inherited from class org.springframework.web.bind.WebDataBinder
DEFAULT_FIELD_MARKER_PREFIX, DEFAULT_FIELD_DEFAULT_PREFIX, DEFAULT_OBJECT_NAME, DEFAULT_AUTO_GROW_COLLECTION_LIMIT
 
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)

Auto-creates the a type if it is null and is possible to auto-create.

void bind(org.springframework.beans.PropertyValues propertyValues)

void bind(GrailsParameterMap params)

Binds from a GrailsParameterMap object

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

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').

protected void checkFieldMarkers(org.springframework.beans.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, javax.servlet.http.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(org.springframework.beans.MutablePropertyValues mpvs)

protected boolean isAllowed(java.lang.String field)

static void registerCustomEditors(GrailsWebRequest grailsWebRequest, org.springframework.beans.PropertyEditorRegistry registry, java.util.Locale locale)

Registers all known

 
Methods inherited from class org.springframework.web.bind.ServletRequestDataBinder
org.springframework.web.bind.ServletRequestDataBinder#bind(javax.servlet.ServletRequest), org.springframework.web.bind.ServletRequestDataBinder#closeNoCatch(), org.springframework.web.bind.ServletRequestDataBinder#setFieldMarkerPrefix(java.lang.String), org.springframework.web.bind.ServletRequestDataBinder#getFieldMarkerPrefix(), org.springframework.web.bind.ServletRequestDataBinder#setFieldDefaultPrefix(java.lang.String), org.springframework.web.bind.ServletRequestDataBinder#getFieldDefaultPrefix(), org.springframework.web.bind.ServletRequestDataBinder#setBindEmptyMultipartFiles(boolean), org.springframework.web.bind.ServletRequestDataBinder#isBindEmptyMultipartFiles(), org.springframework.web.bind.ServletRequestDataBinder#close(), org.springframework.web.bind.ServletRequestDataBinder#validate(), org.springframework.web.bind.ServletRequestDataBinder#validate([Ljava.lang.Object;), org.springframework.web.bind.ServletRequestDataBinder#bind(org.springframework.beans.PropertyValues), org.springframework.web.bind.ServletRequestDataBinder#getTarget(), org.springframework.web.bind.ServletRequestDataBinder#getErrors(), org.springframework.web.bind.ServletRequestDataBinder#getValidator(), org.springframework.web.bind.ServletRequestDataBinder#getObjectName(), org.springframework.web.bind.ServletRequestDataBinder#getBindingResult(), org.springframework.web.bind.ServletRequestDataBinder#convertIfNecessary(java.lang.Object, java.lang.Class, org.springframework.core.MethodParameter), org.springframework.web.bind.ServletRequestDataBinder#convertIfNecessary(java.lang.Object, java.lang.Class), org.springframework.web.bind.ServletRequestDataBinder#setConversionService(org.springframework.core.convert.ConversionService), org.springframework.web.bind.ServletRequestDataBinder#getConversionService(), org.springframework.web.bind.ServletRequestDataBinder#registerCustomEditor(java.lang.Class, java.lang.String, java.beans.PropertyEditor), org.springframework.web.bind.ServletRequestDataBinder#registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), org.springframework.web.bind.ServletRequestDataBinder#findCustomEditor(java.lang.Class, java.lang.String), org.springframework.web.bind.ServletRequestDataBinder#setAutoGrowNestedPaths(boolean), org.springframework.web.bind.ServletRequestDataBinder#isAutoGrowNestedPaths(), org.springframework.web.bind.ServletRequestDataBinder#setAutoGrowCollectionLimit(int), org.springframework.web.bind.ServletRequestDataBinder#getAutoGrowCollectionLimit(), org.springframework.web.bind.ServletRequestDataBinder#setExtractOldValueForEditor(boolean), org.springframework.web.bind.ServletRequestDataBinder#initBeanPropertyAccess(), org.springframework.web.bind.ServletRequestDataBinder#initDirectFieldAccess(), org.springframework.web.bind.ServletRequestDataBinder#setIgnoreUnknownFields(boolean), org.springframework.web.bind.ServletRequestDataBinder#isIgnoreUnknownFields(), org.springframework.web.bind.ServletRequestDataBinder#setIgnoreInvalidFields(boolean), org.springframework.web.bind.ServletRequestDataBinder#isIgnoreInvalidFields(), org.springframework.web.bind.ServletRequestDataBinder#setAllowedFields([Ljava.lang.String;), org.springframework.web.bind.ServletRequestDataBinder#getAllowedFields(), org.springframework.web.bind.ServletRequestDataBinder#setDisallowedFields([Ljava.lang.String;), org.springframework.web.bind.ServletRequestDataBinder#getDisallowedFields(), org.springframework.web.bind.ServletRequestDataBinder#setRequiredFields([Ljava.lang.String;), org.springframework.web.bind.ServletRequestDataBinder#getRequiredFields(), org.springframework.web.bind.ServletRequestDataBinder#setMessageCodesResolver(org.springframework.validation.MessageCodesResolver), org.springframework.web.bind.ServletRequestDataBinder#setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor), org.springframework.web.bind.ServletRequestDataBinder#getBindingErrorProcessor(), org.springframework.web.bind.ServletRequestDataBinder#setValidator(org.springframework.validation.Validator), org.springframework.web.bind.ServletRequestDataBinder#wait(), org.springframework.web.bind.ServletRequestDataBinder#wait(long), org.springframework.web.bind.ServletRequestDataBinder#wait(long, int), org.springframework.web.bind.ServletRequestDataBinder#equals(java.lang.Object), org.springframework.web.bind.ServletRequestDataBinder#toString(), org.springframework.web.bind.ServletRequestDataBinder#hashCode(), org.springframework.web.bind.ServletRequestDataBinder#getClass(), org.springframework.web.bind.ServletRequestDataBinder#notify(), org.springframework.web.bind.ServletRequestDataBinder#notifyAll()
 
Methods inherited from class org.springframework.web.bind.WebDataBinder
org.springframework.web.bind.WebDataBinder#setFieldMarkerPrefix(java.lang.String), org.springframework.web.bind.WebDataBinder#getFieldMarkerPrefix(), org.springframework.web.bind.WebDataBinder#setFieldDefaultPrefix(java.lang.String), org.springframework.web.bind.WebDataBinder#getFieldDefaultPrefix(), org.springframework.web.bind.WebDataBinder#setBindEmptyMultipartFiles(boolean), org.springframework.web.bind.WebDataBinder#isBindEmptyMultipartFiles(), org.springframework.web.bind.WebDataBinder#close(), org.springframework.web.bind.WebDataBinder#validate(), org.springframework.web.bind.WebDataBinder#validate([Ljava.lang.Object;), org.springframework.web.bind.WebDataBinder#bind(org.springframework.beans.PropertyValues), org.springframework.web.bind.WebDataBinder#getTarget(), org.springframework.web.bind.WebDataBinder#getErrors(), org.springframework.web.bind.WebDataBinder#getValidator(), org.springframework.web.bind.WebDataBinder#getObjectName(), org.springframework.web.bind.WebDataBinder#getBindingResult(), org.springframework.web.bind.WebDataBinder#convertIfNecessary(java.lang.Object, java.lang.Class, org.springframework.core.MethodParameter), org.springframework.web.bind.WebDataBinder#convertIfNecessary(java.lang.Object, java.lang.Class), org.springframework.web.bind.WebDataBinder#setConversionService(org.springframework.core.convert.ConversionService), org.springframework.web.bind.WebDataBinder#getConversionService(), org.springframework.web.bind.WebDataBinder#registerCustomEditor(java.lang.Class, java.lang.String, java.beans.PropertyEditor), org.springframework.web.bind.WebDataBinder#registerCustomEditor(java.lang.Class, java.beans.PropertyEditor), org.springframework.web.bind.WebDataBinder#findCustomEditor(java.lang.Class, java.lang.String), org.springframework.web.bind.WebDataBinder#setAutoGrowNestedPaths(boolean), org.springframework.web.bind.WebDataBinder#isAutoGrowNestedPaths(), org.springframework.web.bind.WebDataBinder#setAutoGrowCollectionLimit(int), org.springframework.web.bind.WebDataBinder#getAutoGrowCollectionLimit(), org.springframework.web.bind.WebDataBinder#setExtractOldValueForEditor(boolean), org.springframework.web.bind.WebDataBinder#initBeanPropertyAccess(), org.springframework.web.bind.WebDataBinder#initDirectFieldAccess(), org.springframework.web.bind.WebDataBinder#setIgnoreUnknownFields(boolean), org.springframework.web.bind.WebDataBinder#isIgnoreUnknownFields(), org.springframework.web.bind.WebDataBinder#setIgnoreInvalidFields(boolean), org.springframework.web.bind.WebDataBinder#isIgnoreInvalidFields(), org.springframework.web.bind.WebDataBinder#setAllowedFields([Ljava.lang.String;), org.springframework.web.bind.WebDataBinder#getAllowedFields(), org.springframework.web.bind.WebDataBinder#setDisallowedFields([Ljava.lang.String;), org.springframework.web.bind.WebDataBinder#getDisallowedFields(), org.springframework.web.bind.WebDataBinder#setRequiredFields([Ljava.lang.String;), org.springframework.web.bind.WebDataBinder#getRequiredFields(), org.springframework.web.bind.WebDataBinder#setMessageCodesResolver(org.springframework.validation.MessageCodesResolver), org.springframework.web.bind.WebDataBinder#setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor), org.springframework.web.bind.WebDataBinder#getBindingErrorProcessor(), org.springframework.web.bind.WebDataBinder#setValidator(org.springframework.validation.Validator), org.springframework.web.bind.WebDataBinder#wait(), org.springframework.web.bind.WebDataBinder#wait(long), org.springframework.web.bind.WebDataBinder#wait(long, int), org.springframework.web.bind.WebDataBinder#equals(java.lang.Object), org.springframework.web.bind.WebDataBinder#toString(), org.springframework.web.bind.WebDataBinder#hashCode(), org.springframework.web.bind.WebDataBinder#getClass(), org.springframework.web.bind.WebDataBinder#notify(), org.springframework.web.bind.WebDataBinder#notifyAll()
 

Field Detail

DEFAULT_DATE_FORMAT

public static final java.lang.String DEFAULT_DATE_FORMAT


DOMAINCLASS_DISALLOWED

public static final java.lang.String[] DOMAINCLASS_DISALLOWED


GROOVY_DISALLOWED

public static final java.lang.String[] GROOVY_DISALLOWED


GROOVY_DOMAINCLASS_DISALLOWED

public static final java.lang.String[] GROOVY_DOMAINCLASS_DISALLOWED


NULL_ASSOCIATION

public static final java.lang.String NULL_ASSOCIATION


bean

protected org.springframework.beans.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(org.springframework.beans.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(org.springframework.beans.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(org.springframework.beans.PropertyValues propertyValues, java.lang.String prefix)


bind

@Override
public void bind(javax.servlet.ServletRequest request)


bind

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


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


checkFieldMarkers

@Override
protected void checkFieldMarkers(org.springframework.beans.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, javax.servlet.http.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(org.springframework.beans.MutablePropertyValues mpvs)


isAllowed

@Override
protected boolean isAllowed(java.lang.String field)


registerCustomEditors

public static void registerCustomEditors(GrailsWebRequest grailsWebRequest, org.springframework.beans.PropertyEditorRegistry registry, java.util.Locale locale)
Registers all known
Parameters:
grailsWebRequest
registry
locale


 

Groovy Documentation