improved PHP parser
[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 import net.sourceforge.phpdt.core.IType;
14
15 /**
16  * Common protocol for Java elements that can be members of types.
17  * This set consists of <code>IType</code>, <code>IMethod</code>, 
18  * <code>IField</code>, and <code>IInitializer</code>.
19  * <p>
20  * This interface is not intended to be implemented by clients.
21  * </p>
22  */
23 public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation, IParent {
24 /**
25  * Returns the class file in which this member is declared, or <code>null</code>
26  * if this member is not declared in a class file (for example, a source type).
27  * This is a handle-only method.
28  * 
29  * @return the class file in which this member is declared, or <code>null</code>
30  * if this member is not declared in a class file (for example, a source type)
31  */
32 //IClassFile getClassFile();
33 /**
34  * Returns the compilation unit in which this member is declared, or <code>null</code>
35  * if this member is not declared in a compilation unit (for example, a binary type).
36  * This is a handle-only method.
37  * 
38  * @return the compilation unit in which this member is declared, or <code>null</code>
39  * if this member is not declared in a compilation unit (for example, a binary type)
40  */
41 ICompilationUnit getCompilationUnit();
42 /**
43  * Returns the type in which this member is declared, or <code>null</code>
44  * if this member is not declared in a type (for example, a top-level type).
45  * This is a handle-only method.
46  * 
47  * @return the type in which this member is declared, or <code>null</code>
48  * if this member is not declared in a type (for example, a top-level type)
49  */
50  IType getDeclaringType();
51 /**
52  * Returns the modifier flags for this member. The flags can be examined using class
53  * <code>Flags</code>.
54  * <p>
55  * Note that only flags as indicated in the source are returned. Thus if an interface
56  * defines a method <code>void myMethod();</code> the flags don't include the
57  * 'public' flag.
58  *
59  * @exception JavaModelException if this element does not exist or if an
60  *      exception occurs while accessing its corresponding resource.
61  * @return the modifier flags for this member
62  * @see Flags
63  */
64 int getFlags() throws JavaModelException;
65 /**
66  * Returns the source range of this member's simple name,
67  * or <code>null</code> if this member does not have a name
68  * (for example, an initializer), or if this member does not have
69  * associated source code (for example, a binary type).
70  *
71  * @exception JavaModelException if this element does not exist or if an
72  *      exception occurs while accessing its corresponding resource.
73  * @return the source range of this member's simple name,
74  * or <code>null</code> if this member does not have a name
75  * (for example, an initializer), or if this member does not have
76  * associated source code (for example, a binary type)
77  */
78 ISourceRange getNameRange() throws JavaModelException;
79 /**
80  * Returns the local or anonymous type declared in this source member with the given simple name and/or
81  * with the specified position relative to the order they are defined in the source.
82  * The name is empty if it is an anonymous type.
83  * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0).
84  * This is a handle-only method. The type may or may not exist.
85  * Throws a <code>RuntimeException</code> if this member is not a source member.
86  * 
87  * @param name the given simple name
88  * @param occurrenceCount the specified position
89  * @return the type with the given name and/or with the specified position relative to the order they are defined in the source
90  * @since 3.0
91  */
92 IType getType(String name, int occurrenceCount);
93 /**
94  * Returns whether this member is from a class file.
95  * This is a handle-only method.
96  *
97  * @return <code>true</code> if from a class file, and <code>false</code> if
98  *   from a compilation unit
99  */
100 boolean isBinary();
101 }