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;
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>.
18 * This interface is not intended to be implemented by clients.
21 public interface IMember extends IJavaElement, ISourceReference,
22 ISourceManipulation, IParent {
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.
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)
32 // IClassFile getClassFile();
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.
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)
42 ICompilationUnit getCompilationUnit();
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.
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
53 IType getDeclaringType();
56 * Returns the modifier flags for this member. The flags can be examined
57 * using class <code>Flags</code>.
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.
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
69 int getFlags() throws JavaModelException;
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).
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)
85 ISourceRange getNameRange() throws JavaModelException;
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.
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
104 IType getType(String name, int occurrenceCount);
107 * Returns whether this member is from a class file. This is a handle-only
110 * @return <code>true</code> if from a class file, and <code>false</code>
111 * if from a compilation unit