01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.web.bind;
18:
19: import javax.servlet.ServletException;
20: import javax.servlet.ServletRequest;
21:
22: /**
23: * Callback that allows for initialization of a binder with
24: * custom editors before kicking off the binding process.
25: *
26: * <p>This is effectively a way to factor binder initialization out into
27: * a dedicated object, to be invoked through BindUtils. In all other
28: * respects, it is equivalent to the <code>initBinder</code> template
29: * method defined by the BaseCommandController class.
30: *
31: * @author Jean-Pierre Pawlak
32: * @since 08.05.2003
33: * @deprecated since Spring 1.2.7: prefer direct ServletRequestDataBinder usage,
34: * potentially in combination with a PropertyEditorRegistrar
35: * @see ServletRequestDataBinder
36: * @see org.springframework.beans.PropertyEditorRegistrar
37: */
38: public interface BindInitializer {
39:
40: /**
41: * Initialize the given binder instance, e.g. with custom editors.
42: * Called by <code>BindUtils.bind</code>.
43: * <p>This method allows you to register custom editors for certain fields
44: * of your command class. For instance, you will be able to transform Date
45: * objects into a String pattern and back, in order to allow your JavaBeans
46: * to have Date properties and still be able to set and display them in,
47: * for instance, an HTML interface.
48: * @param request current request
49: * @param binder new binder instance
50: * @throws ServletException in case of invalid state or arguments
51: * @see org.springframework.validation.DataBinder#registerCustomEditor
52: */
53: void initBinder(ServletRequest request,
54: ServletRequestDataBinder binder) throws ServletException;
55:
56: }
|