Java Doc for NameLookup.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » internal » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdt.internal.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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

Field Summary
final public static  intACCEPT_ALL
    
final public static  intACCEPT_ANNOTATIONS
     Accept flag for specifying annotations.
final public static  intACCEPT_CLASSES
     Accept flag for specifying classes.
final public static  intACCEPT_ENUMS
     Accept flag for specifying enums.
final public static  intACCEPT_INTERFACES
     Accept flag for specifying interfaces.
public static  booleanVERBOSE
    
protected  IPackageFragmentRoot[]packageFragmentRoots
     The IPackageFragmentRoot's associated with the classpath of this NameLookup facility's project.
protected  HashtableOfArrayToObjectpackageFragments
     Table that maps package names to lists of package fragment roots that contain such a package known by this name lookup facility.
protected  MaprootToResolvedEntries
    
public  longtimeSpentInSeekTypesInBinaryPackage
    
public  longtimeSpentInSeekTypesInSourcePackage
    
protected  HashMaptypesInWorkingCopies
     A map from package handles to a map from type name to an IType or an IType[].

Constructor Summary
public  NameLookup(IPackageFragmentRoot[] packageFragmentRoots, HashtableOfArrayToObject packageFragments, ICompilationUnit[] workingCopies, Map rootToResolvedEntries)
    

Method Summary
protected  booleanacceptType(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  ICompilationUnitfindCompilationUnit(String qualifiedTypeName)
     Returns the ICompilationUnit which defines the type named qualifiedTypeName, or null if none exists.
public  IPackageFragmentfindPackageFragment(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  AnswerfindType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean checkRestrictions)
     Find type considering secondary types but without waiting for indexes.
public  AnswerfindType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor)
     Find type.
public  ITypefindType(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  ITypefindType(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  ITypefindType(String name, boolean partialMatch, int acceptFlags)
     Returns the type specified by the qualified name, or null if none exist.
public  AnswerfindType(String name, boolean partialMatch, int acceptFlags, boolean checkRestrictions)
    
public  AnswerfindType(String name, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor)
    
public  booleanisPackage(String[] pkgName)
    
protected  booleannameMatches(String searchName, IJavaElement element, boolean partialMatch)
     Returns true if the given element's name matches the specified searchName, otherwise false.
protected  booleannameMatches(String searchName, ICompilationUnit cu, boolean partialMatch)
     Returns true if the given cu's name matches the specified searchName, otherwise false.
public  voidseekPackageFragments(String name, boolean partialMatch, IJavaElementRequestor requestor)
     Notifies the given requestor of all package fragments with the given name.
public  voidseekTypes(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  voidseekTypesInBinaryPackage(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, IJavaElementRequestor requestor)
     Performs type search in a binary package.
protected  voidseekTypesInSourcePackage(String name, IPackageFragment pkg, int firstDot, boolean partialMatch, String topLevelTypeName, int acceptFlags, IJavaElementRequestor requestor)
     Performs type search in a source package.
protected  booleanseekTypesInTopLevelType(String prefix, int firstDot, IType topLevelType, IJavaElementRequestor requestor, int acceptFlags)
    
protected  booleanseekTypesInType(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  booleanseekTypesInWorkingCopies(String name, IPackageFragment pkg, int firstDot, boolean partialMatch, String topLevelTypeName, int acceptFlags, IJavaElementRequestor requestor)
    

Field Detail
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.




Constructor Detail
NameLookup
public NameLookup(IPackageFragmentRoot[] packageFragmentRoots, HashtableOfArrayToObject packageFragments, ICompilationUnit[] workingCopies, Map rootToResolvedEntries)(Code)




Method Detail
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)



isPackage
public boolean isPackage(String[] pkgName)(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



seekTypesInBinaryPackage
protected void seekTypesInBinaryPackage(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, IJavaElementRequestor requestor)(Code)
Performs type search in a binary package.



seekTypesInSourcePackage
protected void seekTypesInSourcePackage(String name, IPackageFragment pkg, int firstDot, boolean partialMatch, String topLevelTypeName, int acceptFlags, IJavaElementRequestor requestor)(Code)
Performs type search in a source package.



seekTypesInTopLevelType
protected boolean seekTypesInTopLevelType(String prefix, int firstDot, IType topLevelType, IJavaElementRequestor requestor, int acceptFlags)(Code)



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.



seekTypesInWorkingCopies
protected boolean seekTypesInWorkingCopies(String name, IPackageFragment pkg, int firstDot, boolean partialMatch, String topLevelTypeName, int acceptFlags, IJavaElementRequestor requestor)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.