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 which indicates that a method parameter should be bound
27: * to a web request parameter. Supported for {@link RequestMapping}
28: * annotated handler methods in Servlet and Portlet environments.
29: *
30: * @author Arjen Poutsma
31: * @author Juergen Hoeller
32: * @since 2.5
33: * @see RequestMapping
34: * @see org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
35: * @see org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter
36: */
37: @Target(ElementType.PARAMETER)
38: @Retention(RetentionPolicy.RUNTIME)
39: @Documented
40: public @interface RequestParam {
41:
42: /**
43: * The request parameter to bind to.
44: */
45: String value() default "";
46:
47: /**
48: * Whether the parameter is required.
49: * <p>Default is <code>true</code>, leading to an exception thrown in case
50: * of the parameter missing in the request. Switch this to <code>false</code>
51: * if you prefer a <code>null</value> in case of the parameter missing.
52: */
53: boolean required() default true;
54:
55: }
|