public class ProjectClassLocator extends BaseClassLocator
ProjectClassLocator is an implementation of the
JavaClassLocator to locate classes for a Project instance.| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
ALL_LIBRARIES
Constant indicating all libraries
|
protected static boolean |
EXPORTED_LIBRARIES
Constant indicating we want only exported libraries.
|
EMPTY_COLLECTION, EMPTY_LOCATOR, EMPTY_STRING_ARRAY| Modifier and Type | Method and Description |
|---|---|
void |
buildIndex()
Instructs this class locator to start building its index for locating
files.
|
void |
buildIndexInterruptibly()
Instructs this class locator to start building its index for locating
files.
|
protected static URLPath |
getAddedClassPathFor(Project project)
Utility routine to fetch the added classpath for the given project.
|
void |
getAllClasses(java.util.Collection<java.lang.String> out,
ClassNameFilter filter)
Fetch all of the top-level classes that are known by this locator.
|
void |
getAllClassesInterruptibly(java.util.Collection<java.lang.String> out,
ClassNameFilter filter)
Get all of the top-level classes that are known by this locator.
|
void |
getAllPackages(java.util.Collection<java.lang.String> out,
PackageNameFilter filter)
Fetch all of the full packges that are known by this locator.
|
void |
getAllPackagesInterruptibly(java.util.Collection<java.lang.String> out,
PackageNameFilter filter)
Get all of the full packges that are known by this locator.
|
protected java.util.Collection<BaseClassLocator> |
getChildLocators(java.util.EnumSet<ClasspathTreeVisitOptions> options)
Get the child class locators to be visited.
|
void |
getClassesInPackage(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
Fetch the list of top-level classes within the given package, adding them
to the out collection provided.
|
void |
getClassesInPackageInterruptibly(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
Get the list of top-level classes within the package.
|
protected java.lang.Object |
getClasspathTreeNode()
Get the classpath tree node corresponding to this locator.
|
java.net.URL |
getClassURL(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class
name.
|
java.net.URL |
getClassURLInterruptibly(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class
name.
|
static java.util.Collection |
getDependentsFor(Project project)
Utility routine to fetch the dependents for the given project.
|
protected static ProjectClassLocator |
getInstance(Project project)
Deprecated.
|
protected static ProjectClassLocator |
getInstance(Workspace workspace,
Project project)
Get the class locator instance for a project.
|
protected static ProjectClassLocator |
getInstanceInterruptibly(Project project)
Deprecated.
|
protected static ProjectClassLocator |
getInstanceInterruptibly(Workspace workspace,
Project project)
Get the class locator instance for a project.
|
protected static Library |
getJDKFor(Project project)
Utility routine to fetch the JDK for the given project.
|
protected static URLPath |
getModuleConfigClassPathFor(Project project)
Utility routine to fetch the module config classpath for the given project.
|
java.net.URL |
getNonProjectSourceURL(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
java.net.URL |
getNonProjectSourceURLInterruptibly(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
protected static java.net.URL |
getOutputURLFor(Project project)
Utility routine to fetch the output URL for the given project.
|
void |
getPackages(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
Fetch the list of subpackages within the given package, adding them
to the out collection provided.
|
void |
getPackagesInterruptibly(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
Get the list of subpackages within the given package.
|
java.net.URL |
getProjectSourceURL(java.lang.String fqClassName,
boolean includeDependencies)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
java.net.URL |
getProjectSourceURLInterruptibly(java.lang.String fqClassName,
boolean includeDependencies)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
java.net.URL |
getResourceURL(java.lang.String resourceName)
Fetch the URL for the Java resource file given the resource name.
|
protected BaseClassLocator |
getSourceLocator(BaseClassLocator locator) |
static Path |
getSourcePath(Project project)
Get the source path for a project.
|
static URLPath |
getSourcePathFor(Project project)
Deprecated.
Using a URLPath to represent a source path does not properly
handle filters. Use
getSourcePath(Project) instead. |
java.net.URL |
getSourceURL(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
java.net.URL |
getSourceURLInterruptibly(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
java.net.URL |
getURL(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class
name.
|
java.net.URL |
getURLInterruptibly(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class
name.
|
addToCollection, buildFQName, checkInterrupt, ensureValid, getAllClasses, getAllClasses, getAllClassesInterruptibly, getAllClassesInterruptibly, getAllPackages, getAllPackages, getAllPackagesInterruptibly, getAllPackagesInterruptibly, getClassesByName, getClassesByNameInterruptibly, getClassesByPrefix, getClassesByPrefixInterruptibly, getClassesDirectly, getClassesInPackage, getClassesInPackageInterruptibly, getNameCascades, getNameParts, getPackages, getPackagesInterruptibly, getResourcesDirectly, getResourceURLs, getStringArray, visitClasspathTree, visitClasspathTree, visitJavaTypes, visitJavaTypes, visitResources, visitResourcesprotected static final boolean EXPORTED_LIBRARIES
protected static final boolean ALL_LIBRARIES
protected static ProjectClassLocator getInstance(Workspace workspace, Project project)
workspace - the workspaceproject - the projectjava.lang.NullPointerException - if the workspace or project is nullprotected static ProjectClassLocator getInstanceInterruptibly(Workspace workspace, Project project) throws java.lang.InterruptedException
workspace - the workspaceproject - the projectjava.lang.NullPointerException - if the workspace or project is nulljava.lang.InterruptedException - if the calling thread is interrupted@Deprecated protected static ProjectClassLocator getInstance(Project project)
project - the project@Deprecated protected static ProjectClassLocator getInstanceInterruptibly(Project project) throws java.lang.InterruptedException
project - the projectjava.lang.InterruptedException - if the calling thread is interrupted while
creating the class locator instancepublic static java.util.Collection getDependentsFor(Project project)
project - the projects to fetch the dependents forprotected static URLPath getAddedClassPathFor(Project project)
project - the project to get the added classpath forprotected static URLPath getModuleConfigClassPathFor(Project project)
project - the project to get the module config classpath forprotected static java.net.URL getOutputURLFor(Project project)
project - the project to fetch the output url forpublic static Path getSourcePath(Project project)
project - the project@Deprecated public static URLPath getSourcePathFor(Project project)
getSourcePath(Project) instead.project - the project to fetch the source path forprotected static Library getJDKFor(Project project)
project - the project to fetch the JDK forpublic void buildIndex()
public void buildIndexInterruptibly()
throws java.lang.InterruptedException
JavaClassLocator2buildIndexInterruptibly in interface JavaClassLocator2buildIndexInterruptibly in class BaseClassLocatorjava.lang.InterruptedException - if the build is interruptedpublic void getPackages(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
getPackages in class BaseClassLocatorpackagePrefix - the package prefix, i.e., "java.io"out - the collection to add the packagespublic void getPackagesInterruptibly(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
throws java.lang.InterruptedException
BaseClassLocatorgetPackagesInterruptibly in class BaseClassLocatorpackagePrefix - the package prefixout - the collection where packages are addedjava.lang.InterruptedException - if the operation is interruptedpublic void getClassesInPackage(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
getClassesInPackage in class BaseClassLocatorpackagePrefix - the package prefix, i.e., "java.io"out - the collection to add the class namespublic void getClassesInPackageInterruptibly(java.lang.String packagePrefix,
java.util.Collection<java.lang.String> out)
throws java.lang.InterruptedException
BaseClassLocatorgetClassesInPackageInterruptibly in class BaseClassLocatorpackagePrefix - the package prefixout - the collection where packages are addedjava.lang.InterruptedException - if the operation is interruptedpublic void getAllClasses(java.util.Collection<java.lang.String> out,
ClassNameFilter filter)
getAllClasses in class BaseClassLocatorout - the collection to add the fully-qualified class namesfilter - the class name filter to usepublic void getAllClassesInterruptibly(java.util.Collection<java.lang.String> out,
ClassNameFilter filter)
throws java.lang.InterruptedException
BaseClassLocatorgetAllClassesInterruptibly in class BaseClassLocatorout - the collection where fully qualified class names are addedfilter - the class name filter to usejava.lang.InterruptedException - if the operation is interruptedpublic void getAllPackages(java.util.Collection<java.lang.String> out,
PackageNameFilter filter)
getAllPackages in class BaseClassLocatorout - the collection to add the full package namesfilter - the pckage name filter to usepublic void getAllPackagesInterruptibly(java.util.Collection<java.lang.String> out,
PackageNameFilter filter)
throws java.lang.InterruptedException
BaseClassLocatorgetAllPackagesInterruptibly in class BaseClassLocatorout - the collection where package names are addedfilter - the package name filter to usejava.lang.InterruptedException - if the operation is interruptedpublic java.net.URL getURL(java.lang.String fqClassName)
fqClassName - the fully-qualified class name in dotted notation,
i.e., java.util.Listpublic java.net.URL getURLInterruptibly(java.lang.String fqClassName)
throws java.lang.InterruptedException
JavaClassLocator2getURLInterruptibly in interface JavaClassLocator2getURLInterruptibly in class BaseClassLocatorfqClassName - the fully-qualified class name in dotted notation,
i.e., java.util.Listjava.lang.InterruptedException - if the operation is interruptedpublic java.net.URL getProjectSourceURL(java.lang.String fqClassName,
boolean includeDependencies)
fqClassName - the fully-qualified class name in dotted notationincludeDependencies - include the projects depended on by this
current projectpublic java.net.URL getProjectSourceURLInterruptibly(java.lang.String fqClassName,
boolean includeDependencies)
throws java.lang.InterruptedException
fqClassName - the fully-qualified class name in dotted notationincludeDependencies - include the projects depended on by this
current projectjava.lang.InterruptedException - if the operation is interruptedpublic java.net.URL getNonProjectSourceURL(java.lang.String fqClassName)
public java.net.URL getNonProjectSourceURLInterruptibly(java.lang.String fqClassName)
throws java.lang.InterruptedException
java.lang.InterruptedException - if the operation is interruptedpublic java.net.URL getSourceURL(java.lang.String fqClassName)
fqClassName - the fully-qualified class name in dotted notationpublic java.net.URL getSourceURLInterruptibly(java.lang.String fqClassName)
throws java.lang.InterruptedException
JavaClassLocator2getSourceURLInterruptibly in interface JavaClassLocator2getSourceURLInterruptibly in class BaseClassLocatorfqClassName - the fully-qualified class name in dotted notationjava.lang.InterruptedException - if the operation is interruptedpublic java.net.URL getClassURL(java.lang.String fqClassName)
fqClassName - the fully-qualified class name in dotted notationpublic java.net.URL getClassURLInterruptibly(java.lang.String fqClassName)
throws java.lang.InterruptedException
JavaClassLocator2getClassURLInterruptibly in interface JavaClassLocator2getClassURLInterruptibly in class BaseClassLocatorfqClassName - the fully-qualified class name in dotted notationjava.lang.InterruptedException - if the operation is interruptedpublic java.net.URL getResourceURL(java.lang.String resourceName)
resourceName - the full name of the resource including any file
extensionsprotected java.lang.Object getClasspathTreeNode()
BaseClassLocatorgetClasspathTreeNode in class BaseClassLocatornull if there is no classpath
tree node corresponding to this locatorClasspathTreeprotected java.util.Collection<BaseClassLocator> getChildLocators(java.util.EnumSet<ClasspathTreeVisitOptions> options)
BaseClassLocatorgetChildLocators in class BaseClassLocatoroptions - the classpath tree visit optionsprotected BaseClassLocator getSourceLocator(BaseClassLocator locator)
getSourceLocator in class BaseClassLocator