|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.internal.core.ClasspathEntry
public class ClasspathEntry
IClasspathEntry
Field Summary | |
---|---|
int |
contentKind
Describes the kind of package fragment roots found on this classpath entry - either K_BINARY or K_SOURCE or K_OUTPUT. |
int |
entryKind
Describes the kind of classpath entry - one of CPE_PROJECT, CPE_LIBRARY, CPE_SOURCE, CPE_VARIABLE or CPE_CONTAINER |
static org.eclipse.core.runtime.IPath[] |
EXCLUDE_NONE
|
static org.eclipse.core.runtime.IPath[] |
INCLUDE_ALL
|
boolean |
isExported
The export flag |
static int |
K_OUTPUT
A constant indicating an output location. |
static IAccessRule[] |
NO_ACCESS_RULES
|
static IClasspathAttribute[] |
NO_EXTRA_ATTRIBUTES
|
org.eclipse.core.runtime.IPath |
path
The meaning of the path of a classpath entry depends on its entry kind: Source code in the current project ( CPE_SOURCE ) -
The path associated with this entry is the absolute path to the root folder. |
org.eclipse.core.runtime.IPath |
sourceAttachmentPath
Describes the path to the source archive associated with this classpath entry, or null if this classpath entry has no
source attachment. |
org.eclipse.core.runtime.IPath |
sourceAttachmentRootPath
Describes the path within the source archive where package fragments are located. |
org.eclipse.core.runtime.IPath |
specificOutputLocation
Specific output location (for this source entry) |
static java.lang.String |
TAG_ACCESS_RULE
|
static java.lang.String |
TAG_ACCESS_RULES
|
static java.lang.String |
TAG_ACCESSIBLE
|
static java.lang.String |
TAG_ATTRIBUTE
|
static java.lang.String |
TAG_ATTRIBUTE_NAME
|
static java.lang.String |
TAG_ATTRIBUTE_VALUE
|
static java.lang.String |
TAG_ATTRIBUTES
|
static java.lang.String |
TAG_CLASSPATH
|
static java.lang.String |
TAG_CLASSPATHENTRY
|
static java.lang.String |
TAG_COMBINE_ACCESS_RULES
|
static java.lang.String |
TAG_DISCOURAGED
|
static java.lang.String |
TAG_EXCLUDING
|
static java.lang.String |
TAG_EXPORTED
|
static java.lang.String |
TAG_IGNORE_IF_BETTER
|
static java.lang.String |
TAG_INCLUDING
|
static java.lang.String |
TAG_KIND
|
static java.lang.String |
TAG_NON_ACCESSIBLE
|
static java.lang.String |
TAG_OUTPUT
|
static java.lang.String |
TAG_PATH
|
static java.lang.String |
TAG_PATTERN
|
static java.lang.String |
TAG_ROOTPATH
|
static java.lang.String |
TAG_SOURCEPATH
|
Fields inherited from interface org.eclipse.jdt.core.IClasspathEntry |
---|
CPE_CONTAINER, CPE_LIBRARY, CPE_PROJECT, CPE_SOURCE, CPE_VARIABLE |
Constructor Summary | |
---|---|
ClasspathEntry(int contentKind,
int entryKind,
org.eclipse.core.runtime.IPath path,
org.eclipse.core.runtime.IPath[] inclusionPatterns,
org.eclipse.core.runtime.IPath[] exclusionPatterns,
org.eclipse.core.runtime.IPath sourceAttachmentPath,
org.eclipse.core.runtime.IPath sourceAttachmentRootPath,
org.eclipse.core.runtime.IPath specificOutputLocation,
boolean isExported,
IAccessRule[] accessRules,
boolean combineAccessRules,
IClasspathAttribute[] extraAttributes)
Creates a class path entry of the specified kind with the given path. |
Method Summary | |
---|---|
boolean |
combineAccessRules()
Returns whether the access rules of the project's exported entries should be combined with this entry's access rules. |
ClasspathEntry |
combineWith(ClasspathEntry referringEntry)
Used to perform export/restriction propagation across referring projects/containers |
static IClasspathEntry |
elementDecode(org.w3c.dom.Element element,
IJavaProject project,
java.util.Map unknownElements)
|
void |
elementEncode(org.eclipse.jdt.internal.core.XMLWriter writer,
org.eclipse.core.runtime.IPath projectPath,
boolean indent,
boolean newLine,
java.util.Map unknownElements)
Returns the XML encoding of the class path. |
boolean |
equals(java.lang.Object object)
Returns true if the given object is a classpath entry with equivalent attributes. |
char[][] |
fullExclusionPatternChars()
|
char[][] |
fullInclusionPatternChars()
|
IAccessRule[] |
getAccessRules()
Returns the possibly empty list of access rules for this entry. |
static IAccessRule[] |
getAccessRules(org.eclipse.core.runtime.IPath[] accessibleFiles,
org.eclipse.core.runtime.IPath[] nonAccessibleFiles)
|
AccessRuleSet |
getAccessRuleSet()
|
static org.w3c.dom.NodeList |
getChildAttributes(java.lang.String childName,
org.w3c.dom.NodeList children,
boolean[] foundChildren)
|
int |
getContentKind()
Returns the kind of files found in the package fragments identified by this classpath entry. |
int |
getEntryKind()
Returns the kind of this classpath entry. |
org.eclipse.core.runtime.IPath[] |
getExclusionPatterns()
Returns the set of patterns used to exclude resources or classes associated with this classpath entry. |
IClasspathAttribute[] |
getExtraAttributes()
Returns the extra classpath attributes for this classpath entry. |
org.eclipse.core.runtime.IPath[] |
getInclusionPatterns()
Returns the set of patterns used to explicitly define resources or classes to be included with this classpath entry. |
org.eclipse.core.runtime.IPath |
getOutputLocation()
Returns the full path to the specific location where the builder writes .class files generated for this source entry
(entry kind IClasspathEntry.CPE_SOURCE ). |
org.eclipse.core.runtime.IPath |
getPath()
Returns the path of this classpath entry. |
IClasspathEntry |
getResolvedEntry()
Deprecated. |
org.eclipse.core.runtime.IPath |
getSourceAttachmentPath()
Returns the path to the source archive or folder associated with this classpath entry, or null if this classpath entry has no
source attachment. |
org.eclipse.core.runtime.IPath |
getSourceAttachmentRootPath()
Returns the path within the source archive or folder where package fragments are located. |
int |
hashCode()
Returns the hash code for this classpath entry |
boolean |
isExported()
Returns whether this entry is exported to dependent projects. |
boolean |
isOptional()
|
java.lang.String |
rootID()
Answers an ID which is used to distinguish entries during package fragment root computations |
java.lang.String |
toString()
Returns a printable representation of this classpath entry. |
static IJavaModelStatus |
validateClasspath(IJavaProject javaProject,
IClasspathEntry[] rawClasspath,
org.eclipse.core.runtime.IPath projectOutputLocation)
Validate a given classpath and output location for a project, using the following rules: Classpath entries cannot collide with each other; that is, all entry paths must be unique. |
static IJavaModelStatus |
validateClasspathEntry(IJavaProject project,
IClasspathEntry entry,
boolean checkSourceAttachment,
boolean recurseInContainers)
Returns a Java model status describing the problem related to this classpath entry if any, a status object with code IStatus.OK if the entry is fine (that is, if the
given classpath entry denotes a valid element to be referenced onto a classpath). |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TAG_CLASSPATH
public static final java.lang.String TAG_CLASSPATHENTRY
public static final java.lang.String TAG_OUTPUT
public static final java.lang.String TAG_KIND
public static final java.lang.String TAG_PATH
public static final java.lang.String TAG_SOURCEPATH
public static final java.lang.String TAG_ROOTPATH
public static final java.lang.String TAG_EXPORTED
public static final java.lang.String TAG_INCLUDING
public static final java.lang.String TAG_EXCLUDING
public static final java.lang.String TAG_ATTRIBUTES
public static final java.lang.String TAG_ATTRIBUTE
public static final java.lang.String TAG_ATTRIBUTE_NAME
public static final java.lang.String TAG_ATTRIBUTE_VALUE
public static final java.lang.String TAG_COMBINE_ACCESS_RULES
public static final java.lang.String TAG_ACCESS_RULES
public static final java.lang.String TAG_ACCESS_RULE
public static final java.lang.String TAG_PATTERN
public static final java.lang.String TAG_ACCESSIBLE
public static final java.lang.String TAG_NON_ACCESSIBLE
public static final java.lang.String TAG_DISCOURAGED
public static final java.lang.String TAG_IGNORE_IF_BETTER
public int entryKind
public int contentKind
public org.eclipse.core.runtime.IPath path
CPE_SOURCE
) -
The path associated with this entry is the absolute path to the root folder. 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.
CPE_PROJECT
) - the path of the entry denotes the
path to the corresponding project resource.CPE_VARIABLE
) - the first segment of the path
is the name of a classpath variable. If this classpath variable
is bound to the path CPE_CONTAINER
) - the first segment of the path is denoting
the unique container identifier (for which a ClasspathContainerInitializer
could be
registered), and the remaining segments are used as additional hints for resolving the container entry to
an actual IClasspathContainer
.
public static final org.eclipse.core.runtime.IPath[] INCLUDE_ALL
public static final org.eclipse.core.runtime.IPath[] EXCLUDE_NONE
public static final IClasspathAttribute[] NO_EXTRA_ATTRIBUTES
public static final IAccessRule[] NO_ACCESS_RULES
public org.eclipse.core.runtime.IPath sourceAttachmentPath
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. 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.
public org.eclipse.core.runtime.IPath sourceAttachmentRootPath
null
value
if and only if getSourceAttachmentPath
returns
a non-null
value.
public org.eclipse.core.runtime.IPath specificOutputLocation
public static final int K_OUTPUT
public boolean isExported
Constructor Detail |
---|
public ClasspathEntry(int contentKind, int entryKind, org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath[] inclusionPatterns, org.eclipse.core.runtime.IPath[] exclusionPatterns, org.eclipse.core.runtime.IPath sourceAttachmentPath, org.eclipse.core.runtime.IPath sourceAttachmentRootPath, org.eclipse.core.runtime.IPath specificOutputLocation, boolean isExported, IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes)
Method Detail |
---|
public boolean combineAccessRules()
IClasspathEntry
combineAccessRules
in interface IClasspathEntry
public ClasspathEntry combineWith(ClasspathEntry referringEntry)
public char[][] fullExclusionPatternChars()
public char[][] fullInclusionPatternChars()
public void elementEncode(org.eclipse.jdt.internal.core.XMLWriter writer, org.eclipse.core.runtime.IPath projectPath, boolean indent, boolean newLine, java.util.Map unknownElements)
public static IClasspathEntry elementDecode(org.w3c.dom.Element element, IJavaProject project, java.util.Map unknownElements)
public static org.w3c.dom.NodeList getChildAttributes(java.lang.String childName, org.w3c.dom.NodeList children, boolean[] foundChildren)
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public IAccessRule[] getAccessRules()
IClasspathEntry
getAccessRules
in interface IClasspathEntry
IClasspathEntry.getAccessRules()
public AccessRuleSet getAccessRuleSet()
public int getContentKind()
IClasspathEntry
getContentKind
in interface IClasspathEntry
IPackageFragmentRoot.K_SOURCE
for files containing
source code, and IPackageFragmentRoot.K_BINARY
for binary
class files.
There is no specified value for an entry denoting a variable (IClasspathEntry.CPE_VARIABLE
)
or a classpath container (IClasspathEntry.CPE_CONTAINER
).IClasspathEntry
public int getEntryKind()
IClasspathEntry
getEntryKind
in interface IClasspathEntry
IClasspathEntry.CPE_SOURCE
- this entry describes a source root in
its project
IClasspathEntry.CPE_LIBRARY
- this entry describes a folder or JAR
containing binaries
IClasspathEntry.CPE_PROJECT
- this entry describes another project
IClasspathEntry.CPE_VARIABLE
- this entry describes a project or library
indirectly via a classpath variable in the first segment of the path
*
IClasspathEntry.CPE_CONTAINER
- this entry describes set of entries
referenced indirectly via a classpath container
IClasspathEntry
public org.eclipse.core.runtime.IPath[] getExclusionPatterns()
IClasspathEntry
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 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
).
getExclusionPatterns
in interface IClasspathEntry
null
if this kind
of classpath entry does not support exclusion patternsIClasspathEntry.getExclusionPatterns()
public IClasspathAttribute[] getExtraAttributes()
IClasspathEntry
getExtraAttributes
in interface IClasspathEntry
public org.eclipse.core.runtime.IPath[] getInclusionPatterns()
IClasspathEntry
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:
src/**
by itself includes all
files under a root folder named src
.
src/**
and
tests/**
includes all files under the root folders
named src
and tests
.
src/**
together with the
exclusion pattern src/**/Foo.java
includes all
files under a root folder named src
except for ones
named Foo.java
.
getInclusionPatterns
in interface IClasspathEntry
null
if this kind
of classpath entry does not support inclusion patternsIClasspathEntry.getExclusionPatterns()
public org.eclipse.core.runtime.IPath getOutputLocation()
IClasspathEntry
.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.
getOutputLocation
in interface IClasspathEntry
.class
files for this source entry, or null
if using default output folderIClasspathEntry.getOutputLocation()
public org.eclipse.core.runtime.IPath getPath()
IClasspathEntry
IClasspathEntry.CPE_SOURCE
) -
The path associated with this entry is the absolute path to the root folder. 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 library, then there is no associated resource in
the workbench.
IClasspathEntry.CPE_PROJECT
) - the path of the entry denotes the
path to the corresponding project resource.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.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
).
getPath
in interface IClasspathEntry
IClasspathEntry
public org.eclipse.core.runtime.IPath getSourceAttachmentPath()
IClasspathEntry
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 the 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.
getSourceAttachmentPath
in interface IClasspathEntry
null
if noneIClasspathEntry
public org.eclipse.core.runtime.IPath getSourceAttachmentRootPath()
IClasspathEntry
null
value
if and only if IClasspathEntry.getSourceAttachmentPath()
returns
a non-null
value.
getSourceAttachmentRootPath
in interface IClasspathEntry
null
if
not applicableIClasspathEntry
public int hashCode()
hashCode
in class java.lang.Object
public boolean isExported()
IClasspathEntry
false
for source entries (kind
IClasspathEntry.CPE_SOURCE
), which cannot be exported.
isExported
in interface IClasspathEntry
true
if exported, and false
otherwiseIClasspathEntry.isExported()
public boolean isOptional()
public static IAccessRule[] getAccessRules(org.eclipse.core.runtime.IPath[] accessibleFiles, org.eclipse.core.runtime.IPath[] nonAccessibleFiles)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String rootID()
public IClasspathEntry getResolvedEntry()
IClasspathEntry
null
if unable to resolve using
the following algorithm:
null
null
Variable source attachment is also resolved and recorded in the resulting classpath entry.
getResolvedEntry
in interface IClasspathEntry
null
if the given path could not be resolved to a classpath entry
Note that this deprecated API doesn't handle CPE_CONTAINER entries.
IClasspathEntry
public static IJavaModelStatus validateClasspath(IJavaProject javaProject, IClasspathEntry[] rawClasspath, org.eclipse.core.runtime.IPath projectOutputLocation)
This validation is intended to anticipate classpath issues prior to assigning it to a project. In particular, it will automatically be performed during the classpath setting operation (if validation fails, the classpath setting will not complete).
javaProject
- the given java projectrawClasspath
- a given classpathprojectOutputLocation
- a given output location
IStatus.OK
if
the given classpath and output location are compatible, otherwise a status
object indicating what is wrong with the classpath or output locationpublic static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean recurseInContainers)
IStatus.OK
if the entry is fine (that is, if the
given classpath entry denotes a valid element to be referenced onto a classpath).
project
- the given java projectentry
- the given classpath entrycheckSourceAttachment
- a flag to determine if source attachement should be checkedrecurseInContainers
- flag indicating whether validation should be applied to container entries recursively
IStatus.OK
if the entry is fine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |