12f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye/*
22f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * Copyright (C) 2016 The Android Open Source Project
32f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye *
42f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * Licensed under the Apache License, Version 2.0 (the "License");
52f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * you may not use this file except in compliance with the License.
62f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * You may obtain a copy of the License at
72f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye *
82f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye *      http://www.apache.org/licenses/LICENSE-2.0
92f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye *
102f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * Unless required by applicable law or agreed to in writing, software
112f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * distributed under the License is distributed on an "AS IS" BASIS,
122f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * See the License for the specific language governing permissions and
142f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * limitations under the License.
152f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye */
16ac5fe7c617c66850fff75a9fce9979c6e5674b0fAurimas Liutikaspackage androidx.annotation;
172f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye
182f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbyeimport static java.lang.annotation.ElementType.CONSTRUCTOR;
192f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbyeimport static java.lang.annotation.ElementType.FIELD;
202f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbyeimport static java.lang.annotation.ElementType.METHOD;
219c2b340df88ac4b88bb3e78ae0fd2c844e8f1f15Tor Norbyeimport static java.lang.annotation.ElementType.TYPE;
222f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbyeimport static java.lang.annotation.RetentionPolicy.CLASS;
232f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye
24bf4b77f1b6bfa3ccf6c4fc8c89f1a1fb563b7a65Aurimas Liutikasimport java.lang.annotation.Retention;
25bf4b77f1b6bfa3ccf6c4fc8c89f1a1fb563b7a65Aurimas Liutikasimport java.lang.annotation.Target;
26bf4b77f1b6bfa3ccf6c4fc8c89f1a1fb563b7a65Aurimas Liutikas
272f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye/**
282f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * Denotes that the annotated element should only be called on the given API level
292f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * or higher.
302f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * <p>
312f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * This is similar in purpose to the older {@code @TargetApi} annotation, but more
322f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * clearly expresses that this is a requirement on the caller, rather than being
332f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye * used to "suppress" warnings within the method that exceed the {@code minSdkVersion}.
342f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye */
352f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye@Retention(CLASS)
369c2b340df88ac4b88bb3e78ae0fd2c844e8f1f15Tor Norbye@Target({TYPE,METHOD,CONSTRUCTOR,FIELD})
372f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbyepublic @interface RequiresApi {
382e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye    /**
392e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye     * The API level to require. Alias for {@link #api} which allows you to leave out the
402e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye     * {@code api=} part.
412e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye     */
422f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye    @IntRange(from=1)
432e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye    int value() default 1;
442e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye
452e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye    /** The API level to require */
462e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye    @IntRange(from=1)
472e8f895f0c6633fa6b01c9a59c4fe9c176421bb5Tor Norbye    int api() default 1;
482f677a313ed35f25fd366e48dd9fcd65891d6efaTor Norbye}
49