View Javadoc
1   /*
2    * AutoDAO - Generic DAO on steroids implementation for Java.
3    *
4    * Copyright 2008-2012  Marat Radchenko <slonopotamus@users.sourceforge.net>
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package net.sf.autodao;
19  
20  import java.lang.annotation.Documented;
21  import java.lang.annotation.ElementType;
22  import java.lang.annotation.Retention;
23  import java.lang.annotation.RetentionPolicy;
24  import java.lang.annotation.Target;
25  
26  import org.jetbrains.annotations.NotNull;
27  
28  /**
29   * Use this annotation on finder method parameters if you want to use named parameters in queries.
30   *
31   * <p>See <a href="http://autodao.sourceforge.net/guide.html#Named_parameters">Named parameters</a> for usage.
32   *
33   * <p>It isn't valid to mix named and non-named (indexed) parameters on the same query method. If you're using {@link
34   * Named} with {@link Limit} or {@link Offset}, then normal requirements for them are applied. It is a error to put
35   * {@link Named} on the same parameter as {@link Limit} or {@link Offset}.
36   *
37   * <p>It is a error to use several {@link Named} with same value on single finder method.
38   *
39   * @since AutoDAO 0.1
40   */
41  @Documented
42  @Retention(RetentionPolicy.RUNTIME)
43  @Target(ElementType.PARAMETER)
44  public @interface Named {
45    /** @return parameter name */
46    @NotNull String value();
47  }