• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
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 com.android.ide.common.api;
18 
19 /**
20  * Information about an attribute as gathered from the attrs.xml file where
21  * the attribute was declared. This must include a format (string, reference, float, etc.),
22  * possible flag or enum values, whether it's deprecated and its javadoc.
23  * <p>
24  * <b>NOTE: This is not a public or final API; if you rely on this be prepared
25  * to adjust your code for the next tools release.</b>
26  * </p>
27  */
28 public interface IAttributeInfo {
29 
30     /** An attribute format, e.g. string, reference, float, etc. */
31     public enum Format {
32         STRING,
33         BOOLEAN,
34         INTEGER,
35         FLOAT,
36         REFERENCE,
37         COLOR,
38         DIMENSION,
39         FRACTION,
40         ENUM,
41         FLAG;
42 
43         /**
44          * Returns true if and only if this format is in the given array of
45          * formats
46          *
47          * @param formats An array of formats, or null.
48          * @return True if and only if the given array (if any) contains this
49          *         format.
50          */
in(Format[] formats)51         public boolean in(Format[] formats) {
52             if (formats == null) {
53                 return false;
54             }
55             for (Format f : formats) {
56                 if (f == this) {
57                     return true;
58                 }
59             }
60 
61             return false;
62         }
63     }
64 
65     /** Returns the XML Name of the attribute */
getName()66     public String getName();
67 
68     /** Returns the formats of the attribute. Cannot be null.
69      *  Should have at least one format. */
getFormats()70     public Format[] getFormats();
71 
72     /** Returns the values for enums. null for other types. */
getEnumValues()73     public String[] getEnumValues();
74 
75     /** Returns the values for flags. null for other types. */
getFlagValues()76     public String[] getFlagValues();
77 
78     /** Returns a short javadoc, .i.e. the first sentence. */
getJavaDoc()79     public String getJavaDoc();
80 
81     /** Returns the documentation for deprecated attributes. Null if not deprecated. */
getDeprecatedDoc()82     public String getDeprecatedDoc();
83 
84     /** Returns the fully qualified class name of the view defining this attribute */
getDefinedBy()85     public String getDefinedBy();
86 }
87