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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.core;
13 import net.sourceforge.phpdt.core.IType;
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>.
20 * This interface is not intended to be implemented by clients.
23 public interface IMember extends IJavaElement , ISourceReference, ISourceManipulation, IParent {
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.
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)
32 //IClassFile getClassFile();
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.
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)
41 ICompilationUnit getCompilationUnit();
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.
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)
50 IType getDeclaringType();
52 * Returns the modifier flags for this member. The flags can be examined using class
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
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
64 int getFlags() throws JavaModelException;
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).
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)
78 ISourceRange getNameRange() throws JavaModelException;
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.
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
92 IType getType(String name, int occurrenceCount);
94 * Returns whether this member is from a class file.
95 * This is a handle-only method.
97 * @return <code>true</code> if from a class file, and <code>false</code> if
98 * from a compilation unit