• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 package com.android.tools.metalava.model
17 
18 /**
19  * The visibility levels for classes and class members.
20  *
21  * <p>The order is significant. It is from least visible to most visible, where visibility is in
22  * terms of whether it is viewable in the final generated API.
23  */
24 enum class VisibilityLevel(
25     /** String representation in source code. */
26     val javaSourceCodeModifier: String,
27 
28     /** String representation in user visible messages. */
29     val userVisibleDescription: String,
30 
31     /** Representation in the internal flags. */
32     internal val visibilityFlagValue: Int
33 ) {
34     PACKAGE_PRIVATE(
35         javaSourceCodeModifier = "",
36         userVisibleDescription = "package private",
37         visibilityFlagValue = ModifierFlags.PACKAGE_PRIVATE,
38     ),
39     PRIVATE(
40         javaSourceCodeModifier = "private",
41         userVisibleDescription = "private",
42         visibilityFlagValue = ModifierFlags.PRIVATE,
43     ),
44     INTERNAL(
45         javaSourceCodeModifier = "internal",
46         userVisibleDescription = "internal",
47         visibilityFlagValue = ModifierFlags.INTERNAL,
48     ),
49     PROTECTED(
50         javaSourceCodeModifier = "protected",
51         userVisibleDescription = "protected",
52         visibilityFlagValue = ModifierFlags.PROTECTED,
53     ),
54     PUBLIC(
55         javaSourceCodeModifier = "public",
56         userVisibleDescription = "public",
57         visibilityFlagValue = ModifierFlags.PUBLIC,
58     )
59 }
60