1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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 package androidx.annotation
17 
18 /**
19  * Denotes that the annotated element should be an int or long in the given range.
20  *
21  * Example:
22  * ```
23  * @IntRange(from=0,to=255)
24  * public int getAlpha() {
25  *     ...
26  * }
27  * ```
28  */
29 @MustBeDocumented
30 @Retention(AnnotationRetention.BINARY)
31 @Target(
32     AnnotationTarget.FUNCTION,
33     AnnotationTarget.PROPERTY_GETTER,
34     AnnotationTarget.PROPERTY_SETTER,
35     AnnotationTarget.VALUE_PARAMETER,
36     AnnotationTarget.FIELD,
37     AnnotationTarget.LOCAL_VARIABLE,
38     AnnotationTarget.ANNOTATION_CLASS
39 )
40 public annotation class IntRange(
41     /** Smallest value, inclusive */
42     val from: Long = Long.MIN_VALUE,
43     /** Largest value, inclusive */
44     val to: Long = Long.MAX_VALUE
45 )
46