Java Doc for IClasspathEntry.java in  » IDE-Eclipse » jdt » org » eclipse » jdt » 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.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.eclipse.jdt.core.IClasspathEntry

All known Subclasses:   org.eclipse.jdt.internal.core.ClasspathEntry,
IClasspathEntry
public interface IClasspathEntry (Code)
An entry on a Java project classpath identifying one or more package fragment roots. A classpath entry has a content kind (either source, IPackageFragmentRoot.K_SOURCE , or binary, IPackageFragmentRoot.K_BINARY ), which is inherited by each package fragment root and package fragment associated with the entry.

A classpath entry can refer to any of the following:

  • Source code in the current project. In this case, the entry identifies a root folder in the current project containing package fragments and source files with one of the JavaCore.getJavaLikeExtensions Java-like extensions . The root folder itself represents a default package, subfolders represent package fragments, and files with a Java-like extension (e.g. .java files) represent compilation units. All compilation units will be compiled when the project is built. The classpath entry must specify the absolute path to the root folder. Entries of this kind are associated with the IClasspathEntry.CPE_SOURCE constant. Source classpath entries can carry inclusion and exclusion patterns for selecting which source files appear as compilation units and get compiled when the project is built.
  • A binary library in the current project, in another project, or in the external file system. In this case the entry identifies a JAR (or root folder) containing package fragments and .class files. The classpath entry must specify the absolute path to the JAR (or root folder), and in case it refers to an external JAR, then there is no associated resource in the workbench. Entries of this kind are associated with the IClasspathEntry.CPE_LIBRARY constant.
  • A required project. In this case the entry identifies another project in the workspace. The required project is used as a binary library when compiling (that is, the builder looks in the output location of the required project for required .class files when building). When performing other "development" operations - such as code assist, code resolve, type hierarchy creation, etc. - the source code of the project is referred to. Thus, development is performed against a required project's source code, and compilation is performed against a required project's last built state. The classpath entry must specify the absolute path to the project. Entries of this kind are associated with the IClasspathEntry.CPE_PROJECT constant. Note: referencing a required project with a classpath entry refers to the source code or associated .class files located in its output location. It will also automatically include any other libraries or projects that the required project's classpath refers to, iff the corresponding classpath entries are tagged as being exported ( IClasspathEntry.isExported ). Unless exporting some classpath entries, classpaths are not chained by default - each project must specify its own classpath in its entirety.
  • A path beginning in a classpath variable defined globally to the workspace. Entries of this kind are associated with the IClasspathEntry.CPE_VARIABLE constant. Classpath variables are created using JavaCore.setClasspathVariable(StringIPathorg.eclipse.core.runtime.IProgressMonitor) , and gets resolved, to either a project or library entry, using JavaCore.getResolvedClasspathEntry(IClasspathEntry) . It is also possible to register an automatic initializer ( ClasspathVariableInitializer ), which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer". After resolution, a classpath variable entry may either correspond to a project or a library entry.
  • A named classpath container identified by its container path. A classpath container provides a way to indirectly reference a set of classpath entries through a classpath entry of kind IClasspathEntry.CPE_CONTAINER . Typically, a classpath container can be used to describe a complex library composed of multiple JARs, projects or classpath variables, considering also that containers can be mapped differently on each project. Several projects can reference the same generic container path, but have each of them actually bound to a different container object. The container path is a formed by a first ID segment followed with extra segments, which can be used as additional hints for resolving this container reference. If no container was ever recorded for this container path onto this project (using JavaCore.setClasspathContainer , then a ClasspathContainerInitializer will be activated if any was registered for this container ID onto the extension point "org.eclipse.jdt.core.classpathContainerInitializer". A classpath container entry can be resolved explicitly using JavaCore.getClasspathContainer and the resulting container entries can contain any non-container entry. In particular, it may contain variable entries, which in turn needs to be resolved before being directly used.
    Also note that the container resolution APIs include an IJavaProject argument, so as to allow the same container path to be interpreted in different ways for different projects.

The result of IJavaProject.getResolvedClasspath will have all entries of type IClasspathEntry.CPE_VARIABLE and IClasspathEntry.CPE_CONTAINER resolved to a set of IClasspathEntry.CPE_SOURCE , IClasspathEntry.CPE_LIBRARY or IClasspathEntry.CPE_PROJECT classpath entries.

Any classpath entry other than a source folder (kind IClasspathEntry.CPE_SOURCE ) can be marked as being exported. Exported entries are automatically contributed to dependent projects, along with the project's default output folder, which is implicitly exported, and any auxiliary output folders specified on source classpath entries. The project's output folder(s) are always listed first, followed by the any exported entries.

This interface is not intended to be implemented by clients. Classpath entries can be created via methods on JavaCore .


See Also:   JavaCore.newLibraryEntry(org.eclipse.core.runtime.IPathorg.eclipse.core.runtime.IPathorg.eclipse.core.runtime.IPath)
See Also:   JavaCore.newProjectEntry(org.eclipse.core.runtime.IPath)
See Also:   JavaCore.newSourceEntry(org.eclipse.core.runtime.IPath)
See Also:   JavaCore.newVariableEntry(org.eclipse.core.runtime.IPathorg.eclipse.core.runtime.IPathorg.eclipse.core.runtime.IPath)
See Also:   JavaCore.newContainerEntry(org.eclipse.core.runtime.IPath)
See Also:   ClasspathVariableInitializer
See Also:   ClasspathContainerInitializer


Field Summary
 intCPE_CONTAINER
     Entry kind constant describing a classpath entry representing a name classpath container.
 intCPE_LIBRARY
     Entry kind constant describing a classpath entry identifying a library.
 intCPE_PROJECT
     Entry kind constant describing a classpath entry identifying a required project.
 intCPE_SOURCE
     Entry kind constant describing a classpath entry identifying a folder containing package fragments with source code to be compiled.
 intCPE_VARIABLE
     Entry kind constant describing a classpath entry defined using a path that begins with a classpath variable reference.


Method Summary
 booleancombineAccessRules()
     Returns whether the access rules of the project's exported entries should be combined with this entry's access rules.
 IAccessRule[]getAccessRules()
     Returns the possibly empty list of access rules for this entry.
 intgetContentKind()
     Returns the kind of files found in the package fragments identified by this classpath entry.
 intgetEntryKind()
     Returns the kind of this classpath entry.
 IPath[]getExclusionPatterns()
     Returns the set of patterns used to exclude resources or classes associated with this classpath entry.

For source classpath entries, exclusion patterns allow specified portions of the resource tree rooted at this source entry's path to be filtered out.

 IClasspathAttribute[]getExtraAttributes()
     Returns the extra classpath attributes for this classpath entry.
 IPath[]getInclusionPatterns()
     Returns the set of patterns used to explicitly define resources or classes to be included with this classpath entry.

For source classpath entries, when no inclusion patterns are specified, the source entry includes all relevent files in the resource tree rooted at this source entry's path. Specifying one or more inclusion patterns means that only the specified portions of the resource tree are to be included.

 IPathgetOutputLocation()
     Returns the full path to the specific location where the builder writes .class files generated for this source entry (entry kind IClasspathEntry.CPE_SOURCE ).
 IPathgetPath()
     Returns the path of this classpath entry. The meaning of the path of a classpath entry depends on its entry kind:
  • Source code in the current project ( IClasspathEntry.CPE_SOURCE ) - The path associated with this entry is the absolute path to the root folder.
 IClasspathEntrygetResolvedEntry()
     This is a helper method, which returns the resolved classpath entry denoted by an entry (if it is a variable entry).
 IPathgetSourceAttachmentPath()
     Returns the path to the source archive or folder associated with this classpath entry, or null if this classpath entry has no source attachment.

Only library and variable classpath entries may have source attachments. For library classpath entries, the result path (if present) locates a source archive or folder.

 IPathgetSourceAttachmentRootPath()
     Returns the path within the source archive or folder where package fragments are located.
 booleanisExported()
     Returns whether this entry is exported to dependent projects.

Field Detail
CPE_CONTAINER
int CPE_CONTAINER(Code)
Entry kind constant describing a classpath entry representing a name classpath container.
since:
   2.0



CPE_LIBRARY
int CPE_LIBRARY(Code)
Entry kind constant describing a classpath entry identifying a library. A library is a folder or JAR containing package fragments consisting of pre-compiled binaries.



CPE_PROJECT
int CPE_PROJECT(Code)
Entry kind constant describing a classpath entry identifying a required project.



CPE_SOURCE
int CPE_SOURCE(Code)
Entry kind constant describing a classpath entry identifying a folder containing package fragments with source code to be compiled.



CPE_VARIABLE
int CPE_VARIABLE(Code)
Entry kind constant describing a classpath entry defined using a path that begins with a classpath variable reference.





Method Detail
combineAccessRules
boolean combineAccessRules()(Code)
Returns whether the access rules of the project's exported entries should be combined with this entry's access rules. Returns true for container entries. Returns false otherwise. whether the access rules of the project's exported entries should be combined with this entry's access rules
since:
   3.1



getAccessRules
IAccessRule[] getAccessRules()(Code)
Returns the possibly empty list of access rules for this entry. the possibly empty list of access rules for this entry
since:
   3.1



getContentKind
int getContentKind()(Code)
Returns the kind of files found in the package fragments identified by this classpath entry. IPackageFragmentRoot.K_SOURCE for files containingsource code, and IPackageFragmentRoot.K_BINARY for binaryclass files.There is no specified value for an entry denoting a variable (IClasspathEntry.CPE_VARIABLE)or a classpath container (IClasspathEntry.CPE_CONTAINER).



getEntryKind
int getEntryKind()(Code)
Returns the kind of this classpath entry. one of:



getExclusionPatterns
IPath[] getExclusionPatterns()(Code)
Returns the set of patterns used to exclude resources or classes associated with this classpath entry.

For source classpath entries, exclusion patterns allow specified portions of the resource tree rooted at this source entry's path to be filtered out. If no exclusion patterns are specified, this source entry includes all relevent files. Each path specified must be a relative path, and will be interpreted relative to this source entry's path. File patterns are case-sensitive. A file matched by one or more of these patterns is excluded from the corresponding package fragment root. Exclusion patterns have higher precedence than inclusion patterns; in other words, exclusion patterns can remove files for the ones that are to be included, not the other way around.

Note that there is no need to supply a pattern to exclude ".class" files because a source entry filters these out automatically.

The pattern mechanism is similar to Ant's. Each pattern is represented as a relative path. The path segments can be regular file or folder names or simple patterns involving standard wildcard characters.

'*' matches 0 or more characters within a segment. So *.java matches .java, a.java and Foo.java, but not Foo.properties (does not end with .java).

'?' matches 1 character within a segment. So ?.java matches a.java, A.java, but not .java or xyz.java (neither have just one character before .java).

Combinations of *'s and ?'s are allowed.

The special pattern '**' matches zero or more segments. In a source entry, a path like tests/ that ends in a trailing separator is interpreted as tests/**, and would match everything under the folder named tests.

Example patterns in source entries (assuming that "java" is the only JavaCore.getJavaLikeExtensions Java-like extension ):

  • tests/** (or simply tests/) matches all files under a root folder named tests. This includes tests/Foo.java and tests/com/example/Foo.java, but not com/example/tests/Foo.java (not under a root folder named tests).
  • tests/* matches all files directly below a root folder named tests. This includes tests/Foo.java and tests/FooHelp.java but not tests/com/example/Foo.java (not directly under a folder named tests) or com/Foo.java (not under a folder named tests).
  • **/tests/** matches all files under any folder named tests. This includes tests/Foo.java, com/examples/tests/Foo.java, and com/examples/tests/unit/Foo.java, but not com/example/Foo.java (not under a folder named tests).

the possibly empty list of resource exclusion patterns associated with this classpath entry, or null if this kindof classpath entry does not support exclusion patterns
since:
   2.1



getExtraAttributes
IClasspathAttribute[] getExtraAttributes()(Code)
Returns the extra classpath attributes for this classpath entry. Returns an empty array if this entry has no extra attributes. the possibly empty list of extra classpath attributes for this classpath entry
since:
   3.1



getInclusionPatterns
IPath[] getInclusionPatterns()(Code)
Returns the set of patterns used to explicitly define resources or classes to be included with this classpath entry.

For source classpath entries, when no inclusion patterns are specified, the source entry includes all relevent files in the resource tree rooted at this source entry's path. Specifying one or more inclusion patterns means that only the specified portions of the resource tree are to be included. Each path specified must be a relative path, and will be interpreted relative to this source entry's path. File patterns are case-sensitive. A file matched by one or more of these patterns is included in the corresponding package fragment root unless it is excluded by one or more of this entrie's exclusion patterns. Exclusion patterns have higher precedence than inclusion patterns; in other words, exclusion patterns can remove files for the ones that are to be included, not the other way around.

See IClasspathEntry.getExclusionPatterns() for a discussion of the syntax and semantics of path patterns. The absence of any inclusion patterns is semantically equivalent to the explicit inclusion pattern **.

Example patterns in source entries:

  • The inclusion pattern src/** by itself includes all files under a root folder named src.
  • The inclusion patterns src/** and tests/** includes all files under the root folders named src and tests.
  • The inclusion pattern src/** together with the exclusion pattern src/**/Foo.java includes all files under a root folder named src except for ones named Foo.java.

the possibly empty list of resource inclusion patterns associated with this classpath entry, or null if this kindof classpath entry does not support inclusion patterns
since:
   3.0



getOutputLocation
IPath getOutputLocation()(Code)
Returns the full path to the specific location where the builder writes .class files generated for this source entry (entry kind IClasspathEntry.CPE_SOURCE ).

Source entries can optionally be associated with a specific output location. If none is provided, the source entry will be implicitly associated with its project default output location (see IJavaProject.getOutputLocation ).

NOTE: A specific output location cannot coincidate with another source/library entry.

the full path to the specific location where the builder writes .class files for this source entry, or nullif using default output folder
since:
   2.1



getPath
IPath getPath()(Code)
Returns the path of this classpath entry. The meaning of the path of a classpath entry depends on its entry kind:
  • Source code in the current project ( IClasspathEntry.CPE_SOURCE ) - The path associated with this entry is the absolute path to the root folder.
  • A binary library in the current project ( IClasspathEntry.CPE_LIBRARY ) - the path associated with this entry is the absolute path to the JAR (or root folder), and in case it refers to an external JAR, then there is no associated resource in the workbench.
  • A required project ( IClasspathEntry.CPE_PROJECT ) - the path of the entry denotes the path to the corresponding project resource.
  • A variable entry ( IClasspathEntry.CPE_VARIABLE ) - the first segment of the path is the name of a classpath variable. If this classpath variable is bound to the path P, the path of the corresponding classpath entry is computed by appending to P the segments of the returned path without the variable.
  • A container entry ( IClasspathEntry.CPE_CONTAINER ) - the path of the entry is the name of the classpath container, which can be bound indirectly to a set of classpath entries after resolution. The containerPath is a formed by a first ID segment followed with extra segments that can be used as additional hints for resolving this container reference (also see IClasspathContainer ).
the path of this classpath entry



getResolvedEntry
IClasspathEntry getResolvedEntry()(Code)
This is a helper method, which returns the resolved classpath entry denoted by an entry (if it is a variable entry). It is obtained by resolving the variable reference in the first segment. Returns null if unable to resolve using the following algorithm:
  • if variable segment cannot be resolved, returns null
  • finds a project, JAR or binary folder in the workspace at the resolved path location
  • if none finds an external JAR file or folder outside the workspace at the resolved path location
  • if none returns null

Variable source attachment is also resolved and recorded in the resulting classpath entry.

the resolved library or project classpath entry, or nullif the given path could not be resolved to a classpath entry

Note that this deprecated API doesn't handle CPE_CONTAINER entries.JavaCore.getResolvedClasspathEntry(IClasspathEntry)




getSourceAttachmentPath
IPath getSourceAttachmentPath()(Code)
Returns the path to the source archive or folder associated with this classpath entry, or null if this classpath entry has no source attachment.

Only library and variable classpath entries may have source attachments. For library classpath entries, the result path (if present) locates a source archive or folder. This archive or folder can be located in a project of the workspace or outside thr workspace. For variable classpath entries, the result path (if present) has an analogous form and meaning as the variable path, namely the first segment is the name of a classpath variable.

the path to the source archive or folder, or null if none



getSourceAttachmentRootPath
IPath getSourceAttachmentRootPath()(Code)
Returns the path within the source archive or folder where package fragments are located. An empty path indicates that packages are located at the root of the source archive or folder. Returns a non-null value if and only if IClasspathEntry.getSourceAttachmentPath returns a non-null value. the path within the source archive or folder, or null ifnot applicable



isExported
boolean isExported()(Code)
Returns whether this entry is exported to dependent projects. Always returns false for source entries (kind IClasspathEntry.CPE_SOURCE ), which cannot be exported. true if exported, and false otherwise
since:
   2.0



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