org.springframework.web.bind
Class BindUtils

java.lang.Object
  extended byorg.springframework.web.bind.BindUtils

public abstract class BindUtils
extends Object

Offers convenience methods for binding servlet request parameters to objects, including optional validation.

Since:
10.03.2003
Author:
Juergen Hoeller, Jean-Pierre Pawlak

Constructor Summary
BindUtils()
           
 
Method Summary
static BindException bind(ServletRequest request, Object object, String objectName)
          Bind the parameters from the given request to the given object.
static BindException bind(ServletRequest request, Object object, String objectName, BindInitializer initializer)
          Bind the parameters from the given request to the given object, allowing for optional custom editors set in an bind initializer.
static BindException bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator)
          Bind the parameters from the given request to the given object, invoking the given validator.
static BindException bindAndValidate(ServletRequest request, Object object, String objectName, Validator validator, BindInitializer initializer)
          Bind the parameters from the given request to the given object, invoking the given validator, and allowing for optional custom editors set in an bind initializer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindUtils

public BindUtils()
Method Detail

bind

public static BindException bind(ServletRequest request,
                                 Object object,
                                 String objectName)
Bind the parameters from the given request to the given object.

Parameters:
request - request containing the parameters
object - object to bind the parameters to
objectName - name of the bind object
Returns:
the binder used (can be treated as BindException or Errors instance)

bind

public static BindException bind(ServletRequest request,
                                 Object object,
                                 String objectName,
                                 BindInitializer initializer)
                          throws ServletException
Bind the parameters from the given request to the given object, allowing for optional custom editors set in an bind initializer.

Parameters:
request - request containing the parameters
object - object to bind the parameters to
objectName - name of the bind object
initializer - implementation of the BindInitializer interface which will be able to set custom editors
Returns:
the binder used (can be treated as BindException or Errors instance)
Throws:
ServletException - if thrown by the BindInitializer

bindAndValidate

public static BindException bindAndValidate(ServletRequest request,
                                            Object object,
                                            String objectName,
                                            Validator validator)
Bind the parameters from the given request to the given object, invoking the given validator.

Parameters:
request - request containing the parameters
object - object to bind the parameters to
objectName - name of the bind object
validator - validator to be invoked, or null if no validation
Returns:
the binder used (can be treated as Errors instance)

bindAndValidate

public static BindException bindAndValidate(ServletRequest request,
                                            Object object,
                                            String objectName,
                                            Validator validator,
                                            BindInitializer initializer)
                                     throws ServletException
Bind the parameters from the given request to the given object, invoking the given validator, and allowing for optional custom editors set in an bind initializer.

Parameters:
request - request containing the parameters
object - object to bind the parameters to
objectName - name of the bind object
validator - validator to be invoked, or null if no validation
initializer - Implementation of the BindInitializer interface which will be able to set custom editors
Returns:
the binder used (can be treated as Errors instance)
Throws:
ServletException - if thrown by the BindInitializer


Copyright (C) 2003-2004 The Spring Framework Project.