Ashley Rose | 041d90b | 2018-11-07 17:35:19 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 android.view.inspector; |
| 18 | |
| 19 | import static java.lang.annotation.ElementType.TYPE; |
| 20 | import static java.lang.annotation.RetentionPolicy.SOURCE; |
| 21 | |
Ashley Rose | c1a4dec | 2018-12-13 18:06:30 -0500 | [diff] [blame] | 22 | import android.annotation.TestApi; |
| 23 | |
Ashley Rose | 041d90b | 2018-11-07 17:35:19 -0500 | [diff] [blame] | 24 | import java.lang.annotation.Retention; |
| 25 | import java.lang.annotation.Target; |
| 26 | |
| 27 | /** |
| 28 | * Marks the node name to display to a developer in the inspection tree. |
| 29 | * |
| 30 | * This annotation is optional to marking a class as inspectable. If it is omitted, the node name |
| 31 | * will be inferred using the semantics of {@link Class#getSimpleName()}. The fully qualified class |
| 32 | * name is always available in the tree, this is for display purposes only. If a class is inflated |
| 33 | * from XML and the tag it inflates from does not match its simple name, this annotation should be |
| 34 | * used to inform the inspector to display the XML tag name in the inspection tree view. |
| 35 | * |
| 36 | * This annotation does not inherit. If a class extends an annotated parent class, but does not |
| 37 | * annotate itself, its node name will be inferred from its Java name. |
| 38 | * |
Ashley Rose | d2c5f45 | 2018-11-29 15:40:10 -0500 | [diff] [blame] | 39 | * @see InspectionCompanion#getNodeName() |
Ashley Rose | 041d90b | 2018-11-07 17:35:19 -0500 | [diff] [blame] | 40 | * @hide |
| 41 | */ |
| 42 | @Target({TYPE}) |
| 43 | @Retention(SOURCE) |
Ashley Rose | c1a4dec | 2018-12-13 18:06:30 -0500 | [diff] [blame] | 44 | @TestApi |
Ashley Rose | 041d90b | 2018-11-07 17:35:19 -0500 | [diff] [blame] | 45 | public @interface InspectableNodeName { |
| 46 | /** |
| 47 | * The display name for nodes of this type. |
| 48 | * |
| 49 | * @return The name for nodes of this type |
| 50 | */ |
| 51 | String value(); |
| 52 | } |