VisibleForTesting.java revision 282e181b58cf72b6ca770dc7ca5f91f135444502
1282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/*
2282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Copyright (C) 2010 The Android Open Source Project
3282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
4282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Licensed under the Apache License, Version 2.0 (the "License");
5282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * you may not use this file except in compliance with the License.
6282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * You may obtain a copy of the License at
7282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
8282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *      http://www.apache.org/licenses/LICENSE-2.0
9282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
10282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Unless required by applicable law or agreed to in writing, software
11282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * distributed under the License is distributed on an "AS IS" BASIS,
12282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * See the License for the specific language governing permissions and
14282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * limitations under the License.
15282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
16282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
17282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipackage com.android.tools.layoutlib.annotations;
18282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
19282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport java.lang.annotation.Retention;
20282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport java.lang.annotation.RetentionPolicy;
21282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
22282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/**
23282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Denotes that the class, method or field has its visibility relaxed so
24282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * that unit tests can access it.
25282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * <p/>
26282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * The <code>visibility</code> argument can be used to specific what the original
27282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * visibility should have been if it had not been made public or package-private for testing.
28282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * The default is to consider the element private.
29282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
30282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski@Retention(RetentionPolicy.SOURCE)
31282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipublic @interface VisibleForTesting {
32282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    /**
33282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski     * Intended visibility if the element had not been made public or package-private for
34282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski     * testing.
35282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski     */
36282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    enum Visibility {
37282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        /** The element should be considered protected. */
38282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        PROTECTED,
39282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        /** The element should be considered package-private. */
40282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        PACKAGE,
41282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        /** The element should be considered private. */
42282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        PRIVATE
43282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
44282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
45282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    /**
46282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski     * Intended visibility if the element had not been made public or package-private for testing.
47282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski     * If not specified, one should assume the element originally intended to be private.
48282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski     */
49282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    Visibility visibility() default Visibility.PRIVATE;
50282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski}
51