1055b4925fb282a029e6058b2d670f4a416df205bTor Norbye/*
2055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * Copyright (C) 2015 The Android Open Source Project
3055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *
4055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * Licensed under the Apache License, Version 2.0 (the "License");
5055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * you may not use this file except in compliance with the License.
6055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * You may obtain a copy of the License at
7055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *
8055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *      http://www.apache.org/licenses/LICENSE-2.0
9055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *
10055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * Unless required by applicable law or agreed to in writing, software
11055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * distributed under the License is distributed on an "AS IS" BASIS,
12055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * See the License for the specific language governing permissions and
14055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * limitations under the License.
15055b4925fb282a029e6058b2d670f4a416df205bTor Norbye */
16055b4925fb282a029e6058b2d670f4a416df205bTor Norbyepackage android.support.annotation;
17055b4925fb282a029e6058b2d670f4a416df205bTor Norbye
18055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport java.lang.annotation.Retention;
19055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport java.lang.annotation.Target;
20055b4925fb282a029e6058b2d670f4a416df205bTor Norbye
21055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport static java.lang.annotation.ElementType.FIELD;
22055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport static java.lang.annotation.ElementType.LOCAL_VARIABLE;
23055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport static java.lang.annotation.ElementType.METHOD;
24055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport static java.lang.annotation.ElementType.PARAMETER;
25055b4925fb282a029e6058b2d670f4a416df205bTor Norbyeimport static java.lang.annotation.RetentionPolicy.CLASS;
26055b4925fb282a029e6058b2d670f4a416df205bTor Norbye
27055b4925fb282a029e6058b2d670f4a416df205bTor Norbye/**
28055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * Denotes that the annotated element should be an int or long in the given range
29055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * <p>
30055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * Example:
31055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * <pre>{@code
32055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *  &#64;IntRange(from=0,to=255)
33055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *  public int getAlpha() {
34055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *      ...
35055b4925fb282a029e6058b2d670f4a416df205bTor Norbye *  }
36055b4925fb282a029e6058b2d670f4a416df205bTor Norbye * }</pre>
37055b4925fb282a029e6058b2d670f4a416df205bTor Norbye */
38055b4925fb282a029e6058b2d670f4a416df205bTor Norbye@Retention(CLASS)
39055b4925fb282a029e6058b2d670f4a416df205bTor Norbye@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE})
40055b4925fb282a029e6058b2d670f4a416df205bTor Norbyepublic @interface IntRange {
41055b4925fb282a029e6058b2d670f4a416df205bTor Norbye    /** Smallest value, inclusive */
42055b4925fb282a029e6058b2d670f4a416df205bTor Norbye    long from() default Long.MIN_VALUE;
43055b4925fb282a029e6058b2d670f4a416df205bTor Norbye    /** Largest value, inclusive */
44055b4925fb282a029e6058b2d670f4a416df205bTor Norbye    long to() default Long.MAX_VALUE;
45055b4925fb282a029e6058b2d670f4a416df205bTor Norbye}