blob: 2a2572a4664f0b076b72e3acd381a75602a41e42 [file] [log] [blame]
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07001/*
2 * Copyright (C) 2008 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
17public abstract class MemberInfo extends DocInfo implements Comparable, Scoped
18{
19 public MemberInfo(String rawCommentText, String name, String signature,
20 ClassInfo containingClass, ClassInfo realContainingClass,
21 boolean isPublic, boolean isProtected,
22 boolean isPackagePrivate, boolean isPrivate,
23 boolean isFinal, boolean isStatic, boolean isSynthetic,
24 String kind,
25 SourcePositionInfo position,
26 AnnotationInstanceInfo[] annotations)
27 {
28 super(rawCommentText, position);
29 mName = name;
30 mSignature = signature;
31 mContainingClass = containingClass;
32 mRealContainingClass = realContainingClass;
33 mIsPublic = isPublic;
34 mIsProtected = isProtected;
35 mIsPackagePrivate = isPackagePrivate;
36 mIsPrivate = isPrivate;
37 mIsFinal = isFinal;
38 mIsStatic = isStatic;
39 mIsSynthetic = isSynthetic;
40 mKind = kind;
41 mAnnotations = annotations;
42 }
43
44 public abstract boolean isExecutable();
45
46 public String anchor()
47 {
48 if (mSignature != null) {
49 return mName + mSignature;
50 } else {
51 return mName;
52 }
53 }
54
55 public String htmlPage() {
56 return mContainingClass.htmlPage() + "#" + anchor();
57 }
58
59 public int compareTo(Object that) {
60 return this.htmlPage().compareTo(((MemberInfo)that).htmlPage());
61 }
62
63 public String name()
64 {
65 return mName;
66 }
67
68 public String signature()
69 {
70 return mSignature;
71 }
72
73 public ClassInfo realContainingClass()
74 {
75 return mRealContainingClass;
76 }
77
78 public ClassInfo containingClass()
79 {
80 return mContainingClass;
81 }
82
83 public boolean isPublic()
84 {
85 return mIsPublic;
86 }
87
88 public boolean isProtected()
89 {
90 return mIsProtected;
91 }
92
93 public boolean isPackagePrivate()
94 {
95 return mIsPackagePrivate;
96 }
97
98 public boolean isPrivate()
99 {
100 return mIsPrivate;
101 }
102
103 public boolean isStatic()
104 {
105 return mIsStatic;
106 }
107
108 public boolean isFinal()
109 {
110 return mIsFinal;
111 }
112
113 public boolean isSynthetic()
114 {
115 return mIsSynthetic;
116 }
117
118 public ContainerInfo parent()
119 {
120 return mContainingClass;
121 }
122
123 public boolean checkLevel()
124 {
125 return DroidDoc.checkLevel(mIsPublic, mIsProtected,
126 mIsPackagePrivate, mIsPrivate, isHidden());
127 }
128
129 public String kind()
130 {
131 return mKind;
132 }
133
134 public AnnotationInstanceInfo[] annotations()
135 {
136 return mAnnotations;
137 }
138
139 ClassInfo mContainingClass;
140 ClassInfo mRealContainingClass;
141 String mName;
142 String mSignature;
143 boolean mIsPublic;
144 boolean mIsProtected;
145 boolean mIsPackagePrivate;
146 boolean mIsPrivate;
147 boolean mIsFinal;
148 boolean mIsStatic;
149 boolean mIsSynthetic;
150 String mKind;
151 private AnnotationInstanceInfo[] mAnnotations;
152
153}
154