01: /*
02: * Copyright 2002-2007 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.annotation;
18:
19: import java.lang.annotation.Documented;
20: import java.lang.annotation.ElementType;
21: import java.lang.annotation.Retention;
22: import java.lang.annotation.RetentionPolicy;
23: import java.lang.annotation.Target;
24:
25: /**
26: * Annotation that identifies methods which initialize the
27: * {@link org.springframework.web.bind.WebDataBinder} which
28: * will be used for populating command and form object arguments
29: * of annotated handler methods.
30: *
31: * <p>Such init-binder methods support all arguments that {@link RequestMapping}
32: * supports, except for command/form objects and corresponding validation result
33: * objects. Init-binder methods must not have a return value; they are usually
34: * declared as <code>void</code>.
35: *
36: * <p>Typical arguments are {@link org.springframework.web.bind.WebDataBinder}
37: * in combination with {@link org.springframework.web.context.request.WebRequest}
38: * or {@link java.util.Locale}, allowing to register context-specific editors.
39: *
40: * @author Juergen Hoeller
41: * @since 2.5
42: * @see org.springframework.web.bind.WebDataBinder
43: * @see org.springframework.web.context.request.WebRequest
44: */
45: @Target({ElementType.METHOD})
46: @Retention(RetentionPolicy.RUNTIME)
47: @Documented
48: public @interface InitBinder {
49:
50: /**
51: * The names of command/form attributes that this init-binder method
52: * is supposed to apply to.
53: * <p>Default is to apply to all command/form attributes used by
54: * the annotated handler class. Specifying model attribute names here
55: * restricts the init-binder method to those specific model attributes,
56: * with different init-binder methods applying to different attributes.
57: */
58: String[] value() default {};
59:
60: }
|