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