Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.jdeveloper.java
Interface JavaClassLocator

All Known Subinterfaces:
JavaClassLocator2
All Known Implementing Classes:
ArrayClassLocator, BaseClassLocator, CachedDirURLClassLocator, DebugClassLocator, DirURLClassLocator, JarURLClassLocator, JdevPathClassLocator, LibraryClassLocator, LocatorWrapper, PathClassLocator, ProjectClassLocator, URLClassLocator

public interface JavaClassLocator

The JavaClassLocator is the interface for locating Java classes and packages, and for resolving the URLs for Java classes.

This interface is intended primarily for locating top-level classes (not inner classes). Implementations are not required to provide locator support for inner classes (for performance reasons).


Method Summary
 void buildIndex()
          Instructs this class locator to start building its index for locating files.
 java.util.Collection<java.lang.String> getAllClasses()
          Fetch all of the top-level classes that are known by this locator.
 java.util.Collection<java.lang.String> getAllClasses(ClassNameFilter filter)
          Fetch all of the top-level classes that are known by this locator that satisfies the given filter.
 java.util.Collection<java.lang.String> getAllPackages()
          Fetch all of the full packges that are known by this locator.
 java.util.Collection<java.lang.String> getAllPackages(PackageNameFilter filter)
          Fetch all of the packages that are known by this locator that satisfies the given filter.
 java.util.Collection<java.lang.String> getClassesByName(java.lang.String name, boolean matchCase)
          Fetch all of the top-level classes that are known by this locator with the given class name.
 java.util.Collection<java.lang.String> getClassesByPrefix(java.lang.String prefix, boolean matchCase)
          Fetch all of the top-level classes that are known by this locator whose given class name starts with the specified prefix.
 java.util.Collection<java.lang.String> getClassesInPackage(java.lang.String packagePrefix)
          Fetch the top-level classes within the given package prefix.
 java.net.URL getClassURL(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
 java.util.Collection<java.lang.String> getPackages(java.lang.String packagePrefix)
          Fetch the list of subpackages within the given package.
 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 getURL(java.lang.String fqClassName)
          Fetch the URL for the JavaFile for the given fully-qualified Java class name.
 

Method Detail

buildIndex

void buildIndex()
Instructs this class locator to start building its index for locating files. This method runs on the current thread and blocks until the index build is completed. To build the index in the background, call this method on a background thread.


getPackages

java.util.Collection<java.lang.String> getPackages(java.lang.String packagePrefix)
Fetch the list of subpackages within the given package. To get a list of top-level packages, use an empty, "", prefix. The names of the subpackages will not contain the package prefix.

Parameters:
packagePrefix - the package prefix, i.e., "java.io"
Returns:
a collection of (String) subpackage names in the given package

getClassesInPackage

java.util.Collection<java.lang.String> getClassesInPackage(java.lang.String packagePrefix)
Fetch the top-level classes within the given package prefix. To get a list of top-level classes that don't have a package, use an empty, "", prefix. Note that this method does not return inner classes.

Parameters:
packagePrefix - the package prefix, i.e., "java.io"
Returns:
a collection of (String) class names (without the package prefix) in the given package

getAllClasses

java.util.Collection<java.lang.String> getAllClasses()
Fetch all of the top-level classes that are known by this locator. This will return fully-qualified class names, such as "java.util.List".

Returns:
a collection of (String) fully-qualified class names known by this locator

getAllClasses

java.util.Collection<java.lang.String> getAllClasses(ClassNameFilter filter)
Fetch all of the top-level classes that are known by this locator that satisfies the given filter. This will return fully-qualified class names, such as "java.util.List".

Parameters:
filter - the class name filter to use for the search
Returns:
a collection of (String) fully-qualified class names known by this locator, and filtered by the given name filter

getAllPackages

java.util.Collection<java.lang.String> getAllPackages()
Fetch all of the full packges that are known by this locator. This will return fully-qualified package names, such as "java.util" or "java.io". This collection will not include the top-level package "".

Returns:
a collection of (String) full package names known by this lcoator

getAllPackages

java.util.Collection<java.lang.String> getAllPackages(PackageNameFilter filter)
Fetch all of the packages that are known by this locator that satisfies the given filter. This will return full package names, such as "java.util", or "java.io". This collection will not include the top-level package "".

Parameters:
filter - the package name filter to use for the search
Returns:
a collection of (String) full package names that are known by this locator, and filtered by the given name filter

getClassesByName

java.util.Collection<java.lang.String> getClassesByName(java.lang.String name,
                                                        boolean matchCase)
Fetch all of the top-level classes that are known by this locator with the given class name. For example, if "List" were specified for the name, this might return an array containing "java.awt.List" and "java.util.List".

Parameters:
name - the unqualified name of the top-level class to locate
matchCase - whether to use case-sensitivity for matching the class name
Returns:
a collection of (String) fully-qualified class names known by this locator with the given class name

getClassesByPrefix

java.util.Collection<java.lang.String> getClassesByPrefix(java.lang.String prefix,
                                                          boolean matchCase)
Fetch all of the top-level classes that are known by this locator whose given class name starts with the specified prefix. For example, if "File" were specified for this name, this might return an array containing "java.io.File", "java.io.FileNotFoundException", and "java.io.FileInputStream", and so on.

Parameters:
prefix - the starting prefix of the class name to locate
matchCase - whether to use case-sensitivity for matching the class name
Returns:
a collection of (String) fully-qualified class names known by this locator with the given class name prefix

getURL

java.net.URL getURL(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class name. The implementation may choose either a class URL or source URL. For example, an implementation may decide to return the URL that is more up-to-date, or an URL that would be faster to load. Note that if the given class is an inner class, this routine may return the URL for the Java source that contains the owning outer class.

Parameters:
fqClassName - the fully-qualified class name in dotted notation, i.e., java.util.List
Returns:
the URL for the JavaFile containing the given class

getSourceURL

java.net.URL getSourceURL(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java class name. This may return null if a source URL is not available for the given fully-qualified class name.

Parameters:
fqClassName - the fully-qualified class name in dotted notation

getClassURL

java.net.URL getClassURL(java.lang.String fqClassName)
Fetch the URL for the JavaFile for the given fully-qualified Java class name. This may return null if a given class URL is not available for the given fully-qualified class name.

Parameters:
fqClassName - the fully-qualified class name in dotted notation

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.