1 /*
2  * Copyright 2019 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 
17 package androidx.annotation
18 
19 /**
20  * Denotes that the annotated function is considered a sample function, and is linked to from the
21  * KDoc of a source module that matches one of the two permitted directory structures:
22  * 1. The source module is an ancestor of the sample module, for example:
23  * ```
24  * library/src/.. // Source file here that links to a sample
25  * library/samples/src/.. // Sample file here that is linked to by the source file
26  * ```
27  * 2. The source module is a sibling to the sample module, for example:
28  * ```
29  * library/library-subfeature/src/.. // Source file here that links to a sample
30  * library/samples/src/.. // Sample file here that is linked to by the source file
31  * ```
32  *
33  * There are corresponding lint checks ensuring that functions referred to from KDoc with a
34  * `@sample` tag are annotated with this annotation, and also to ensure that any functions annotated
35  * with this annotation are linked to from a `@sample` tag.
36  */
37 @Target(AnnotationTarget.FUNCTION) @Retention(AnnotationRetention.SOURCE) annotation class Sampled
38