Home | History | Annotate | Download | only in model
      1 /*
      2  * Copyright (C) 2009 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 signature.model;
     18 
     19 import java.util.List;
     20 import java.util.Set;
     21 
     22 /**
     23  * {@code IClassDefinition} models a class definition. This is the model
     24  * equivalent to a class.
     25  */
     26 public interface IClassDefinition extends ITypeDefinition, IGenericDeclaration,
     27         IAnnotatableElement {
     28 
     29     /**
     30      * Returns the kind of this class definition.
     31      *
     32      * @return the kind of this class definition
     33      */
     34     Kind getKind();
     35 
     36     /**
     37      * Returns the name of this class definition.
     38      *
     39      * @return the name of this class definition
     40      */
     41     String getName();
     42 
     43     /**
     44      * Returns the '.' separated package name of this class.
     45      *
     46      * @return the '.' separated package name of this class
     47      */
     48     String getPackageName();
     49 
     50     /**
     51      * Returns a list containing each package fragment.
     52      * <p>
     53      * If {@link #getPackageName()} returns : "a.b.c" this method returns a list
     54      * containing the three elements "a", "b", "c".
     55      * <p>
     56      * Note: this method exists only for convenience in output templating.
     57      *
     58      * @return a list containing each package fragment
     59      */
     60     List<String> getPackageFragments();
     61 
     62     /**
     63      * Returns the qualified name of this class definition. The qualified name
     64      * is composed of {@link #getPackageName()} '.' {@link #getName()}
     65      *
     66      * @return the qualified name of this class definition
     67      */
     68     String getQualifiedName();
     69 
     70     /**
     71      * Returns the super class for this class definition. May return {@code
     72      * null} if this class definition does not have any superclass. This is the
     73      * case if the kind of this class definition is {@link Kind#INTERFACE} or
     74      * this class definition is {@link Object}.
     75      *
     76      * @return the super class for this class definition or {@code null}
     77      */
     78     ITypeReference getSuperClass();
     79 
     80     /**
     81      * Returns the declared interfaces this class definition implements . If no
     82      * interfaces are declared, an empty set is returned.
     83      *
     84      * @return the declared interfaces for this class definition
     85      */
     86     Set<ITypeReference> getInterfaces();
     87 
     88     /**
     89      * Returns the modifiers for this class definition.
     90      *
     91      * @return the modifiers for this class definition
     92      */
     93     Set<Modifier> getModifiers();
     94 
     95     /**
     96      * Returns all declared methods of this class definition.
     97      *
     98      * @return all declared methods of this class definition
     99      */
    100     Set<IMethod> getMethods();
    101 
    102     /**
    103      * Returns all declared constructors of this class definition.
    104      *
    105      * @return all declared constructors of this class definition
    106      */
    107     Set<IConstructor> getConstructors();
    108 
    109     /**
    110      * Returns all declared fields of this class definition.
    111      *
    112      * @return all declared fields of this class definition
    113      */
    114     Set<IField> getFields();
    115 
    116     /**
    117      * Returns all declared enumeration constant definitions of this class
    118      * definition. The returned set may only contain elements if the kind of
    119      * this class definition is {@link Kind#ENUM}.
    120      *
    121      * @return all declared enumeration constants of this class definition
    122      */
    123     Set<IEnumConstant> getEnumConstants();
    124 
    125     /**
    126      * Returns all declared annotation field definitions of this class
    127      * definition. The returned set may only contain elements if the kind of
    128      * this class definition is {@link Kind#ANNOTATION}.
    129      *
    130      * @return all declared annotation fields of this class definition
    131      */
    132     Set<IAnnotationField> getAnnotationFields();
    133 
    134     /**
    135      * Returns all classes which where defined in the lexical scope of this
    136      * class definition. Anonymous classes are never returned.
    137      *
    138      * @return all classes which where defined in the lexical scope of this
    139      *         class definition
    140      */
    141     Set<IClassDefinition> getInnerClasses();
    142 }
    143