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 /**
27 * Put this annotation on generic dao method argument that should act as query limit.
28 *
29 * <p>See <a href="http://autodao.sourceforge.net/guide.html#Paging_results">Paging results</a> for usage.
30 *
31 * <p>Parameter must be of type <code>int</code> or {@link Integer}. If parameter is of type {@link Integer} and
32 * <code>null</code> is passed then no limit is assumed. Single parameter can have both {@link Limit} and {@link Offset}
33 * but this is unlikely to be useful. Parameters marked with {@link Limit} won't be passed to underlying ORM as query
34 * parameters. This annotation can only be used in methods that return collection and only on one parameter.
35 *
36 * @see Offset
37 * @since AutoDAO 0.1
38 */
39 @Documented
40 @Retention(RetentionPolicy.RUNTIME)
41 @Target(ElementType.PARAMETER)
42 public @interface Limit {
43
44 }