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 binds a method parameter or method return value
27: * to a named model attribute, exposed to a web view. Supported
28: * for {@link RequestMapping} annotated handler classes.
29: *
30: * <p>Can be used to expose command objects to a web view, using
31: * specific attribute names, through annotating corresponding
32: * parameters of a {@link RequestMapping} annotated handler method).
33: *
34: * <p>Can also be used to expose reference data to a web view
35: * through annotating accessor methods in a controller class which
36: * is based on {@link RequestMapping} annotated handler methods,
37: * with such accessor methods allowed to have any arguments that
38: * {@link RequestMapping} supports for handler methods, returning
39: * the model attribute value to expose.
40: *
41: * @author Juergen Hoeller
42: * @since 2.5
43: */
44: @Target({ElementType.PARAMETER,ElementType.METHOD})
45: @Retention(RetentionPolicy.RUNTIME)
46: @Documented
47: public @interface ModelAttribute {
48:
49: /**
50: * The name of the model attribute to bind to.
51: * <p>The default model attribute name is inferred from the
52: * attribute type, based on the non-qualified class name:
53: * e.g. "orderAddress" for class "mypackage.OrderAddress".
54: */
55: String value() default "";
56:
57: }
|