|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.internal.core.NameLookup
public class NameLookup
A NameLookup
provides name resolution within a Java project.
The name lookup facility uses the project's classpath to prioritize the
order in which package fragments are searched when resolving a name.
Name lookup only returns a handle when the named element actually
exists in the model; otherwise null
is returned.
There are two logical sets of methods within this interface. Methods
which start with find*
are intended to be convenience methods for quickly
finding an element within another element; for instance, for finding a class within a
package. The other set of methods all begin with seek*
. These methods
do comprehensive searches of the IJavaProject
returning hits
in real time through an IJavaElementRequestor
.
Nested Class Summary | |
---|---|
static class |
NameLookup.Answer
|
Field Summary | |
---|---|
static int |
ACCEPT_ALL
|
static int |
ACCEPT_ANNOTATIONS
Accept flag for specifying annotations. |
static int |
ACCEPT_CLASSES
Accept flag for specifying classes. |
static int |
ACCEPT_ENUMS
Accept flag for specifying enums. |
static int |
ACCEPT_INTERFACES
Accept flag for specifying interfaces. |
long |
timeSpentInSeekTypesInBinaryPackage
|
long |
timeSpentInSeekTypesInSourcePackage
|
static boolean |
VERBOSE
|
Fields inherited from interface org.eclipse.jdt.internal.compiler.util.SuffixConstants |
---|
EXTENSION_class, EXTENSION_CLASS, EXTENSION_java, EXTENSION_JAVA, SUFFIX_class, SUFFIX_CLASS, SUFFIX_java, SUFFIX_JAVA, SUFFIX_STRING_class, SUFFIX_STRING_CLASS, SUFFIX_STRING_java, SUFFIX_STRING_JAVA |
Constructor Summary | |
---|---|
NameLookup(IPackageFragmentRoot[] packageFragmentRoots,
HashtableOfArrayToObject packageFragments,
ICompilationUnit[] workingCopies,
java.util.Map rootToResolvedEntries)
|
Method Summary | |
---|---|
ICompilationUnit |
findCompilationUnit(java.lang.String qualifiedTypeName)
Returns the ICompilationUnit which defines the type
named qualifiedTypeName , or null if
none exists. |
IPackageFragment |
findPackageFragment(org.eclipse.core.runtime.IPath path)
Returns the package fragment whose path matches the given (absolute) path, or null if none exist. |
IPackageFragment[] |
findPackageFragments(java.lang.String name,
boolean partialMatch)
Returns the package fragments whose name matches the given (qualified) name, or null if none exist. |
IPackageFragment[] |
findPackageFragments(java.lang.String name,
boolean partialMatch,
boolean patternMatch)
Returns the package fragments whose name matches the given (qualified) name or pattern, or null if none exist. |
IType |
findType(java.lang.String name,
boolean partialMatch,
int acceptFlags)
Returns the type specified by the qualified name, or null
if none exist. |
NameLookup.Answer |
findType(java.lang.String name,
boolean partialMatch,
int acceptFlags,
boolean checkRestrictions)
|
NameLookup.Answer |
findType(java.lang.String name,
boolean partialMatch,
int acceptFlags,
boolean considerSecondaryTypes,
boolean waitForIndexes,
boolean checkRestrictions,
org.eclipse.core.runtime.IProgressMonitor monitor)
|
IType |
findType(java.lang.String name,
IPackageFragment pkg,
boolean partialMatch,
int acceptFlags)
Returns the first type in the given package whose name matches the given (unqualified) name, or null if none
exist. |
IType |
findType(java.lang.String name,
IPackageFragment pkg,
boolean partialMatch,
int acceptFlags,
boolean considerSecondaryTypes)
Returns the first type in the given package whose name matches the given (unqualified) name, or null if none
exist. |
NameLookup.Answer |
findType(java.lang.String typeName,
java.lang.String packageName,
boolean partialMatch,
int acceptFlags,
boolean checkRestrictions)
Find type considering secondary types but without waiting for indexes. |
NameLookup.Answer |
findType(java.lang.String typeName,
java.lang.String packageName,
boolean partialMatch,
int acceptFlags,
boolean considerSecondaryTypes,
boolean waitForIndexes,
boolean checkRestrictions,
org.eclipse.core.runtime.IProgressMonitor monitor)
Find type. |
boolean |
isPackage(java.lang.String[] pkgName)
|
void |
seekPackageFragments(java.lang.String name,
boolean partialMatch,
IJavaElementRequestor requestor)
Notifies the given requestor of all package fragments with the given name. |
void |
seekTypes(java.lang.String name,
IPackageFragment pkg,
boolean partialMatch,
int acceptFlags,
IJavaElementRequestor requestor)
Notifies the given requestor of all types (classes and interfaces) in the given package fragment with the given (unqualified) name. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ACCEPT_CLASSES
public static final int ACCEPT_INTERFACES
public static final int ACCEPT_ENUMS
public static final int ACCEPT_ANNOTATIONS
public static final int ACCEPT_ALL
public static boolean VERBOSE
public long timeSpentInSeekTypesInSourcePackage
public long timeSpentInSeekTypesInBinaryPackage
Constructor Detail |
---|
public NameLookup(IPackageFragmentRoot[] packageFragmentRoots, HashtableOfArrayToObject packageFragments, ICompilationUnit[] workingCopies, java.util.Map rootToResolvedEntries)
Method Detail |
---|
public ICompilationUnit findCompilationUnit(java.lang.String qualifiedTypeName)
ICompilationUnit
which defines the type
named qualifiedTypeName
, or null
if
none exists. The domain of the search is bounded by the classpath
of the IJavaProject
this NameLookup
was
obtained from.
The name must be fully qualified (eg "java.lang.Object", "java.util.Hashtable$Entry")
public IPackageFragment findPackageFragment(org.eclipse.core.runtime.IPath path)
null
if none exist. The domain of
the search is bounded by the classpath of the IJavaProject
this NameLookup
was obtained from.
The path can be:
- internal to the workbench: "/Project/src"
- external to the workbench: "c:/jdk/classes.zip/java/lang"
public IPackageFragment[] findPackageFragments(java.lang.String name, boolean partialMatch)
null
if none exist.
The name can be:
partialMatch
- partial name matches qualify when true
,
only exact name matches qualify when false
public IPackageFragment[] findPackageFragments(java.lang.String name, boolean partialMatch, boolean patternMatch)
null
if none exist.
The name can be:
partialMatch
- partial name matches qualify when true
,patternMatch
- true
when the given name might be a pattern,
false
otherwise.public NameLookup.Answer findType(java.lang.String typeName, java.lang.String packageName, boolean partialMatch, int acceptFlags, boolean checkRestrictions)
public NameLookup.Answer findType(java.lang.String typeName, java.lang.String packageName, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, org.eclipse.core.runtime.IProgressMonitor monitor)
public IType findType(java.lang.String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes)
null
if none
exist. Specifying a null
package will result in no matches.
The domain of the search is bounded by the Java project from which
this name lookup was obtained.
name
- the name of the type to findpkg
- the package to searchpartialMatch
- partial name matches qualify when true
,
only exact name matches qualify when false
acceptFlags
- a bit mask describing if classes, interfaces or both classes and interfaces
are desired results. If no flags are specified, all types are returned.considerSecondaryTypes
- flag to know whether secondary types has to be considered
during the searchACCEPT_CLASSES
,
ACCEPT_INTERFACES
,
ACCEPT_ENUMS
,
ACCEPT_ANNOTATIONS
public IType findType(java.lang.String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags)
null
if none
exist. Specifying a null
package will result in no matches.
The domain of the search is bounded by the Java project from which
this name lookup was obtained.
name
- the name of the type to findpkg
- the package to searchpartialMatch
- partial name matches qualify when true
,
only exact name matches qualify when false
acceptFlags
- a bit mask describing if classes, interfaces or both classes and interfaces
are desired results. If no flags are specified, all types are returned.ACCEPT_CLASSES
,
ACCEPT_INTERFACES
,
ACCEPT_ENUMS
,
ACCEPT_ANNOTATIONS
public IType findType(java.lang.String name, boolean partialMatch, int acceptFlags)
null
if none exist. The domain of
the search is bounded by the Java project from which this name lookup was obtained.
name
- the name of the type to findpartialMatch
- partial name matches qualify when true
,
only exact name matches qualify when false
acceptFlags
- a bit mask describing if classes, interfaces or both classes and interfaces
are desired results. If no flags are specified, all types are returned.ACCEPT_CLASSES
,
ACCEPT_INTERFACES
,
ACCEPT_ENUMS
,
ACCEPT_ANNOTATIONS
public NameLookup.Answer findType(java.lang.String name, boolean partialMatch, int acceptFlags, boolean checkRestrictions)
public NameLookup.Answer findType(java.lang.String name, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, org.eclipse.core.runtime.IProgressMonitor monitor)
public boolean isPackage(java.lang.String[] pkgName)
public void seekPackageFragments(java.lang.String name, boolean partialMatch, IJavaElementRequestor requestor)
IJavaProject
this NameLookup
was obtained from.
partialMatch
- partial name matches qualify when true
;
only exact name matches qualify when false
public void seekTypes(java.lang.String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, IJavaElementRequestor requestor)
null
, all types in the
project whose simple name matches the given name are found.
name
- The name to searchpkg
- The corresponding package fragmentpartialMatch
- partial name matches qualify when true
;
only exact name matches qualify when false
acceptFlags
- a bit mask describing if classes, interfaces or both classes and interfaces
are desired results. If no flags are specified, all types are returned.requestor
- The requestor that collects the resultACCEPT_CLASSES
,
ACCEPT_INTERFACES
,
ACCEPT_ENUMS
,
ACCEPT_ANNOTATIONS
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |