Home | History | Annotate | Download | only in src
      1 /*
      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 
     17 public 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     @Override
    119     public ContainerInfo parent()
    120     {
    121         return mContainingClass;
    122     }
    123 
    124     public boolean checkLevel()
    125     {
    126         return DroidDoc.checkLevel(mIsPublic, mIsProtected,
    127                 mIsPackagePrivate, mIsPrivate, isHidden());
    128     }
    129 
    130     public String kind()
    131     {
    132         return mKind;
    133     }
    134 
    135     public AnnotationInstanceInfo[] annotations()
    136     {
    137         return mAnnotations;
    138     }
    139 
    140     ClassInfo mContainingClass;
    141     ClassInfo mRealContainingClass;
    142     String mName;
    143     String mSignature;
    144     boolean mIsPublic;
    145     boolean mIsProtected;
    146     boolean mIsPackagePrivate;
    147     boolean mIsPrivate;
    148     boolean mIsFinal;
    149     boolean mIsStatic;
    150     boolean mIsSynthetic;
    151     String mKind;
    152     private AnnotationInstanceInfo[] mAnnotations;
    153 
    154 }
    155 
    156