001 /*
002 * The contents of this file are subject to the terms
003 * of the Common Development and Distribution License
004 * (the "License"). You may not use this file except
005 * in compliance with the License.
006 *
007 * You can obtain a copy of the license at
008 * http://www.opensource.org/licenses/cddl1.php
009 * See the License for the specific language governing
010 * permissions and limitations under the License.
011 */
012
013 /*
014 * DefaultValue.java
015 *
016 * Created on November 16, 2006, 2:04 PM
017 *
018 */
019
020 package javax.ws.rs;
021
022 import java.lang.annotation.ElementType;
023 import java.lang.annotation.Retention;
024 import java.lang.annotation.RetentionPolicy;
025 import java.lang.annotation.Target;
026
027 /**
028 * Defines the default value of request metadata that is bound using one of the
029 * following annotations:
030 * {@link javax.ws.rs.PathParam},
031 * {@link javax.ws.rs.QueryParam},
032 * {@link javax.ws.rs.MatrixParam},
033 * {@link javax.ws.rs.CookieParam},
034 * {@link javax.ws.rs.FormParam},
035 * or {@link javax.ws.rs.HeaderParam}.
036 * The default value is used if the corresponding metadata is not present in the
037 * request.
038 *
039 * <p>If the type of the annotated parameter is
040 * <code>List</code>, <code>Set</code> or <code>SortedSet</code> then the
041 * resulting collection will have a single entry mapped from the supplied
042 * default value.</p>
043 *
044 * <p>If this annotation is not used and the corresponding metadata is not
045 * present in the request, the value will be an empty collection for
046 * <code>List</code>, <code>Set</code> or <code>SortedSet</code>, null for
047 * other object types, and the Java-defined default for primitive types.</p>
048 *
049 * @see PathParam
050 * @see QueryParam
051 * @see FormParam
052 * @see HeaderParam
053 * @see MatrixParam
054 * @see CookieParam
055 */
056 @Target({ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD})
057 @Retention(RetentionPolicy.RUNTIME)
058 public @interface DefaultValue {
059 /**
060 * The default value.
061 */
062 String value();
063 }