Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/puppycrawl/tools/checkstyle/checks/usage/transmogrify/IClass.java


1   
2   // Transmogrify License
3   // 
4   // Copyright (c) 2001, ThoughtWorks, Inc.
5   // All rights reserved.
6   // Redistribution and use in source and binary forms, with or without
7   // modification, are permitted provided that the following conditions
8   // are met:
9   // - Redistributions of source code must retain the above copyright notice,
10  //   this list of conditions and the following disclaimer.
11  // - Redistributions in binary form must reproduce the above copyright
12  // notice, this list of conditions and the following disclaimer in the
13  // documentation and/or other materials provided with the distribution.
14  // Neither the name of the ThoughtWorks, Inc. nor the names of its
15  // contributors may be used to endorse or promote products derived from this
16  // software without specific prior written permission.
17  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21  // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22  // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23  // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24  // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25  // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26  // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27  // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  
29  package com.puppycrawl.tools.checkstyle.checks.usage.transmogrify;
30  
31  
32  
33  import java.util.List;
34  
35  /**
36   * interface implemented by classes/interfaces definition, for source or
37   * non-sourced classes and interfaces
38   * The implementor of this class have all information about its inner classes,
39   * methods, variables, subclasses, etc.
40   * @see net.sourceforge.transmogrify.symtab.ClassDef
41   * @see net.sourceforge.transmogrify.symtab.ExternalClass
42   */
43  public interface IClass extends IDefinition {
44  
45    /**
46     * gets superclass definition of this class
47     * @return superclass of this class definition
48     */
49    public IClass getSuperclass();
50  
51    /**
52     * gets interfaces definition implemented by this class definition
53     * @return interfaces implemented
54     */
55    public IClass[] getInterfaces();
56  
57    /**
58     * gets subclasses definition of this class definition
59     * @return list of subclasses definition
60     */
61    public List getSubclasses();
62  
63    /**
64     * gets class definition referenced by this class, including its inner classes,
65     * imported classes, packages, and its parent scope referenced class definitions
66     * @param name name of the class definition to be searched
67     * @return class definition that matches the input name
68     */
69    public IClass getClassDefinition(String name);
70  
71    /**
72     * gets the method associated with the given name and signature
73     *
74     * @param name the name of the method
75     * @param signature the signature (formal parameter types) of the method
76     *
77     * @return <code>MethodDef</code>
78     *
79     * @see MethodSignature
80     */
81    public IMethod getMethodDefinition(String name,
82                                       ISignature signature);
83  
84    /**
85     * gets the <code>VariableDef</code> associated with the given name
86     *
87     * @param name the name of the variable
88     *
89     * @return <code>VariableDef</code>
90     */
91    public IVariable getVariableDefinition(String name);
92  
93    // end definitions interface
94  
95    /**
96     * adds <code>ClassDef</code> to the collection of (direct?) subclasses of
97     * this class
98     *
99     * @param subclass the class to add
100    * @return <code>void</code>
101    */
102   public void addSubclass(ClassDef subclass);
103 
104   /**
105    * adds <code>ClassDef</code> to the collection of implemented interfaces
106    * of this class
107    *
108    * @param implementor the interface to add
109    * @return <code>void</code>
110    */
111   public void addImplementor(ClassDef implementor);
112 
113   /**
114    * gets the list of <code>ClassDefs</code> that implmement this interface
115    *
116    * @return Vector the list of implementors
117    */
118   public List getImplementors();
119 
120   /**
121    * verifies if the input type is equal to this class or its superclass or
122    * its interfaces
123    * @param type class to be compared with
124    * @return <code>true</code> if the input type is equals
125    *         <code>false</code> otherwise
126    */
127   public boolean isCompatibleWith(IClass type);
128 
129   /**
130    * verifies if this class is of primitive Java type
131    * @return <code>true</code> if the class is a primitive type
132    *         <code>false</code> otherwise
133    */
134   public boolean isPrimitive();
135 
136   /**
137    * gets inner classes definition associated with this class
138    * @return array of inner classes
139    */
140   public IClass[] getInnerClasses();
141 
142 }