A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / core / IMember.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.core;
12
13 /**
14  * Common protocol for Java elements that can be members of types. This set
15  * consists of <code>IType</code>, <code>IMethod</code>,
16  * <code>IField</code>, and <code>IInitializer</code>.
17  * <p>
18  * This interface is not intended to be implemented by clients.
19  * </p>
20  */
21 public interface IMember extends IJavaElement, ISourceReference,
22                 ISourceManipulation, IParent {
23         /**
24          * Returns the class file in which this member is declared, or
25          * <code>null</code> if this member is not declared in a class file (for
26          * example, a source type). This is a handle-only method.
27          * 
28          * @return the class file in which this member is declared, or
29          *         <code>null</code> if this member is not declared in a class
30          *         file (for example, a source type)
31          */
32         // IClassFile getClassFile();
33         /**
34          * Returns the compilation unit in which this member is declared, or
35          * <code>null</code> if this member is not declared in a compilation unit
36          * (for example, a binary type). This is a handle-only method.
37          * 
38          * @return the compilation unit in which this member is declared, or
39          *         <code>null</code> if this member is not declared in a
40          *         compilation unit (for example, a binary type)
41          */
42         ICompilationUnit getCompilationUnit();
43
44         /**
45          * Returns the type in which this member is declared, or <code>null</code>
46          * if this member is not declared in a type (for example, a top-level type).
47          * This is a handle-only method.
48          * 
49          * @return the type in which this member is declared, or <code>null</code>
50          *         if this member is not declared in a type (for example, a
51          *         top-level type)
52          */
53         IType getDeclaringType();
54
55         /**
56          * Returns the modifier flags for this member. The flags can be examined
57          * using class <code>Flags</code>.
58          * <p>
59          * Note that only flags as indicated in the source are returned. Thus if an
60          * interface defines a method <code>void myMethod();</code> the flags
61          * don't include the 'public' flag.
62          * 
63          * @exception JavaModelException
64          *                if this element does not exist or if an exception occurs
65          *                while accessing its corresponding resource.
66          * @return the modifier flags for this member
67          * @see Flags
68          */
69         int getFlags() throws JavaModelException;
70
71         /**
72          * Returns the source range of this member's simple name, or
73          * <code>null</code> if this member does not have a name (for example, an
74          * initializer), or if this member does not have associated source code (for
75          * example, a binary type).
76          * 
77          * @exception JavaModelException
78          *                if this element does not exist or if an exception occurs
79          *                while accessing its corresponding resource.
80          * @return the source range of this member's simple name, or
81          *         <code>null</code> if this member does not have a name (for
82          *         example, an initializer), or if this member does not have
83          *         associated source code (for example, a binary type)
84          */
85         ISourceRange getNameRange() throws JavaModelException;
86
87         /**
88          * Returns the local or anonymous type declared in this source member with
89          * the given simple name and/or with the specified position relative to the
90          * order they are defined in the source. The name is empty if it is an
91          * anonymous type. Numbering starts at 1 (thus the first occurrence is
92          * occurrence 1, not occurrence 0). This is a handle-only method. The type
93          * may or may not exist. Throws a <code>RuntimeException</code> if this
94          * member is not a source member.
95          * 
96          * @param name
97          *            the given simple name
98          * @param occurrenceCount
99          *            the specified position
100          * @return the type with the given name and/or with the specified position
101          *         relative to the order they are defined in the source
102          * @since 3.0
103          */
104         IType getType(String name, int occurrenceCount);
105
106         /**
107          * Returns whether this member is from a class file. This is a handle-only
108          * method.
109          * 
110          * @return <code>true</code> if from a class file, and <code>false</code>
111          *         if from a compilation unit
112          */
113         boolean isBinary();
114 }