| java.lang.Object org.eclipse.jdt.internal.core.NameLookup
NameLookup | public class NameLookup implements SuffixConstants(Code) | | 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 .
|
Inner Class :public static class Answer | |
Method Summary | |
protected boolean | acceptType(IType type, int acceptFlags, boolean isSourceType) Returns true if:
- the given type is an existing class and the flag's
ACCEPT_CLASSES
bit is on
- the given type is an existing interface and the
ACCEPT_INTERFACES
bit is on
- neither the
ACCEPT_CLASSES or ACCEPT_INTERFACES
bit is on
Otherwise, false is returned. | public ICompilationUnit | findCompilationUnit(String qualifiedTypeName) Returns the ICompilationUnit which defines the type
named qualifiedTypeName , or null if
none exists. | public IPackageFragment | findPackageFragment(IPath path) Returns the package fragment whose path matches the given
(absolute) path, or null if none exist. | public IPackageFragment[] | findPackageFragments(String name, boolean partialMatch) Returns the package fragments whose name matches the given
(qualified) name, or null if none exist. | public IPackageFragment[] | findPackageFragments(String name, boolean partialMatch, boolean patternMatch) Returns the package fragments whose name matches the given
(qualified) name or pattern, or null if none exist. | public Answer | findType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean checkRestrictions) Find type considering secondary types but without waiting for indexes. | public Answer | findType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor) Find type. | public IType | findType(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. | public IType | findType(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. | public IType | findType(String name, boolean partialMatch, int acceptFlags) Returns the type specified by the qualified name, or null
if none exist. | public Answer | findType(String name, boolean partialMatch, int acceptFlags, boolean checkRestrictions) | public Answer | findType(String name, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor) | public boolean | isPackage(String[] pkgName) | protected boolean | nameMatches(String searchName, IJavaElement element, boolean partialMatch) Returns true if the given element's name matches the
specified searchName , otherwise false. | protected boolean | nameMatches(String searchName, ICompilationUnit cu, boolean partialMatch) Returns true if the given cu's name matches the
specified searchName , otherwise false. | public void | seekPackageFragments(String name, boolean partialMatch, IJavaElementRequestor requestor) Notifies the given requestor of all package fragments with the
given name. | public void | seekTypes(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.
Checks the requestor at regular intervals to see if the requestor
has canceled. | protected void | seekTypesInBinaryPackage(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, IJavaElementRequestor requestor) Performs type search in a binary package. | protected void | seekTypesInSourcePackage(String name, IPackageFragment pkg, int firstDot, boolean partialMatch, String topLevelTypeName, int acceptFlags, IJavaElementRequestor requestor) Performs type search in a source package. | protected boolean | seekTypesInTopLevelType(String prefix, int firstDot, IType topLevelType, IJavaElementRequestor requestor, int acceptFlags) | protected boolean | seekTypesInType(String prefix, int firstDot, IType type, IJavaElementRequestor requestor, int acceptFlags) Notifies the given requestor of all types (classes and interfaces) in the
given type with the given (possibly qualified) name. | protected boolean | seekTypesInWorkingCopies(String name, IPackageFragment pkg, int firstDot, boolean partialMatch, String topLevelTypeName, int acceptFlags, IJavaElementRequestor requestor) |
ACCEPT_ALL | final public static int ACCEPT_ALL(Code) | | |
ACCEPT_ANNOTATIONS | final public static int ACCEPT_ANNOTATIONS(Code) | | Accept flag for specifying annotations.
|
ACCEPT_CLASSES | final public static int ACCEPT_CLASSES(Code) | | Accept flag for specifying classes.
|
ACCEPT_ENUMS | final public static int ACCEPT_ENUMS(Code) | | Accept flag for specifying enums.
|
ACCEPT_INTERFACES | final public static int ACCEPT_INTERFACES(Code) | | Accept flag for specifying interfaces.
|
VERBOSE | public static boolean VERBOSE(Code) | | |
packageFragmentRoots | protected IPackageFragmentRoot[] packageFragmentRoots(Code) | | The IPackageFragmentRoot 's associated
with the classpath of this NameLookup facility's
project.
|
packageFragments | protected HashtableOfArrayToObject packageFragments(Code) | | Table that maps package names to lists of package fragment roots
that contain such a package known by this name lookup facility.
To allow > 1 package fragment with the same name, values are
arrays of package fragment roots ordered as they appear on the
classpath.
Note if the list is of size 1, then the IPackageFragmentRoot object
replaces the array.
|
rootToResolvedEntries | protected Map rootToResolvedEntries(Code) | | Reverse map from root path to corresponding resolved CP entry
(so as to be able to figure inclusion/exclusion rules)
|
timeSpentInSeekTypesInBinaryPackage | public long timeSpentInSeekTypesInBinaryPackage(Code) | | |
timeSpentInSeekTypesInSourcePackage | public long timeSpentInSeekTypesInSourcePackage(Code) | | |
typesInWorkingCopies | protected HashMap typesInWorkingCopies(Code) | | A map from package handles to a map from type name to an IType or an IType[].
Allows working copies to take precedence over compilation units.
|
acceptType | protected boolean acceptType(IType type, int acceptFlags, boolean isSourceType)(Code) | | Returns true if:
- the given type is an existing class and the flag's
ACCEPT_CLASSES
bit is on
- the given type is an existing interface and the
ACCEPT_INTERFACES
bit is on
- neither the
ACCEPT_CLASSES or ACCEPT_INTERFACES
bit is on
Otherwise, false is returned.
|
findCompilationUnit | public ICompilationUnit findCompilationUnit(String qualifiedTypeName)(Code) | | Returns the 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")
|
findPackageFragment | public IPackageFragment findPackageFragment(IPath path)(Code) | | Returns the package fragment whose path matches the given
(absolute) path, or 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"
|
findPackageFragments | public IPackageFragment[] findPackageFragments(String name, boolean partialMatch)(Code) | | Returns the package fragments whose name matches the given
(qualified) name, or null if none exist.
The name can be:
- empty: ""
- qualified: "pack.pack1.pack2"
Parameters: partialMatch - partial name matches qualify when true ,only exact name matches qualify when false |
findPackageFragments | public IPackageFragment[] findPackageFragments(String name, boolean partialMatch, boolean patternMatch)(Code) | | Returns the package fragments whose name matches the given
(qualified) name or pattern, or null if none exist.
The name can be:
- empty: ""
- qualified: "pack.pack1.pack2"
- a pattern: "pack.*.util"
Parameters: partialMatch - partial name matches qualify when true , Parameters: patternMatch - true when the given name might be a pattern,false otherwise. |
findType | public Answer findType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean checkRestrictions)(Code) | | Find type considering secondary types but without waiting for indexes.
It means that secondary types may be not found under certain circumstances...
See Also: "https://bugs.eclipse.org/bugs/show_bug.cgi?id=118789" |
findType | public Answer findType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor)(Code) | | Find type. Considering secondary types and waiting for indexes depends on given corresponding parameters.
|
findType | public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes)(Code) | | Returns the first type in the given package whose name
matches the given (unqualified) name, or 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.
Parameters: name - the name of the type to find Parameters: pkg - the package to search Parameters: partialMatch - partial name matches qualify when true ,only exact name matches qualify when false Parameters: acceptFlags - a bit mask describing if classes, interfaces or both classes and interfacesare desired results. If no flags are specified, all types are returned. Parameters: considerSecondaryTypes - flag to know whether secondary types has to be consideredduring the search See Also: NameLookup.ACCEPT_CLASSES See Also: NameLookup.ACCEPT_INTERFACES See Also: NameLookup.ACCEPT_ENUMS See Also: NameLookup.ACCEPT_ANNOTATIONS |
findType | public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags)(Code) | | Returns the first type in the given package whose name
matches the given (unqualified) name, or 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.
Note that this method does not find secondary types.
Parameters: name - the name of the type to find Parameters: pkg - the package to search Parameters: partialMatch - partial name matches qualify when true ,only exact name matches qualify when false Parameters: acceptFlags - a bit mask describing if classes, interfaces or both classes and interfacesare desired results. If no flags are specified, all types are returned. See Also: NameLookup.ACCEPT_CLASSES See Also: NameLookup.ACCEPT_INTERFACES See Also: NameLookup.ACCEPT_ENUMS See Also: NameLookup.ACCEPT_ANNOTATIONS |
findType | public IType findType(String name, boolean partialMatch, int acceptFlags)(Code) | | Returns the type specified by the qualified name, or null
if none exist. The domain of
the search is bounded by the Java project from which this name lookup was obtained.
Parameters: name - the name of the type to find Parameters: partialMatch - partial name matches qualify when true ,only exact name matches qualify when false Parameters: acceptFlags - a bit mask describing if classes, interfaces or both classes and interfacesare desired results. If no flags are specified, all types are returned. See Also: NameLookup.ACCEPT_CLASSES See Also: NameLookup.ACCEPT_INTERFACES See Also: NameLookup.ACCEPT_ENUMS See Also: NameLookup.ACCEPT_ANNOTATIONS |
findType | public Answer findType(String name, boolean partialMatch, int acceptFlags, boolean checkRestrictions)(Code) | | |
findType | public Answer findType(String name, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor)(Code) | | |
nameMatches | protected boolean nameMatches(String searchName, IJavaElement element, boolean partialMatch)(Code) | | Returns true if the given element's name matches the
specified searchName , otherwise false.
The partialMatch argument indicates partial matches
should be considered.
NOTE: in partialMatch mode, the case will be ignored, and the searchName must already have
been lowercased.
|
nameMatches | protected boolean nameMatches(String searchName, ICompilationUnit cu, boolean partialMatch)(Code) | | Returns true if the given cu's name matches the
specified searchName , otherwise false.
The partialMatch argument indicates partial matches
should be considered.
NOTE: in partialMatch mode, the case will be ignored, and the searchName must already have
been lowercased.
|
seekPackageFragments | public void seekPackageFragments(String name, boolean partialMatch, IJavaElementRequestor requestor)(Code) | | Notifies the given requestor of all package fragments with the
given name. Checks the requestor at regular intervals to see if the
requestor has canceled. The domain of
the search is bounded by the IJavaProject
this NameLookup was obtained from.
Parameters: partialMatch - partial name matches qualify when true ;only exact name matches qualify when false |
seekTypes | public void seekTypes(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, IJavaElementRequestor requestor)(Code) | | Notifies the given requestor of all types (classes and interfaces) in the
given package fragment with the given (unqualified) name.
Checks the requestor at regular intervals to see if the requestor
has canceled. If the given package fragment is null , all types in the
project whose simple name matches the given name are found.
Parameters: name - The name to search Parameters: pkg - The corresponding package fragment Parameters: partialMatch - partial name matches qualify when true ;only exact name matches qualify when false Parameters: acceptFlags - a bit mask describing if classes, interfaces or both classes and interfacesare desired results. If no flags are specified, all types are returned. Parameters: requestor - The requestor that collects the result See Also: NameLookup.ACCEPT_CLASSES See Also: NameLookup.ACCEPT_INTERFACES See Also: NameLookup.ACCEPT_ENUMS See Also: NameLookup.ACCEPT_ANNOTATIONS |
seekTypesInType | protected boolean seekTypesInType(String prefix, int firstDot, IType type, IJavaElementRequestor requestor, int acceptFlags)(Code) | | Notifies the given requestor of all types (classes and interfaces) in the
given type with the given (possibly qualified) name. Checks
the requestor at regular intervals to see if the requestor
has canceled.
|
|
|