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

E13403-02

oracle.jdeveloper.java.locator
Class BaseClassLocator

java.lang.Object
  extended by oracle.jdeveloper.java.locator.BaseClassLocator
All Implemented Interfaces:
JavaClassLocator, JavaResourceLocator
Direct Known Subclasses:
ArrayClassLocator, DebugClassLocator, LibraryClassLocator, PathClassLocator, ProjectClassLocator, URLClassLocator

public abstract class BaseClassLocator
extends java.lang.Object
implements JavaClassLocator, JavaResourceLocator

The BaseClassLocator is an abstract starting point for a JavaClassLocator that adds the buildIndex() entry point for instructing the locator to build its index. Note that that implementations based on the URLClassLocator is intended to support only top-level classes.


Field Summary
static java.util.Collection EMPTY_COLLECTION
          Singleton empty collection.
static BaseClassLocator EMPTY_LOCATOR
          Locator implementation that does nothing.
static java.lang.String[] EMPTY_STRING_ARRAY
          Singleton empty list.
 
Constructor Summary
BaseClassLocator()
           
 
Method Summary
static void addToCollection(java.lang.Object[] array, java.util.Collection collection)
          Add an array of objects to a collection.
static java.lang.String buildFQName(java.lang.String packagePrefix, java.lang.String className)
          Utility routine to build a fully-qualified name.
protected static BaseClassLocator ensureValid(BaseClassLocator locator)
          Utility routine to ensure that there is a valid locator available.
 java.util.Collection getAllClasses()
          Fetch all of the top-level classes that are known by this locator.
 java.util.Collection getAllClasses(ClassNameFilter filter)
          Fetch all of the top-level classes that are known by this locator that satisfies the given filter.
protected abstract  void getAllClasses(java.util.Collection out, ClassNameFilter filter)
          Fetch all of the top-level classes that are known by this locator.
 java.util.Collection getAllPackages()
          Fetch all of the full packges that are known by this locator.
protected abstract  void getAllPackages(java.util.Collection out, PackageNameFilter filter)
          Fetch all of the full packges that are known by this locator.
 java.util.Collection getAllPackages(PackageNameFilter filter)
          Fetch all of the packages that are known by this locator that satisfies the given filter.
 java.util.Collection 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 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 getClassesInPackage(java.lang.String packagePrefix)
          Fetch the top-level classes within the given package prefix.
protected abstract  void getClassesInPackage(java.lang.String packagePrefix, java.util.Collection out)
          Fetch the list of top-level classes within the given package, adding them to the out collection provided.
protected static java.lang.String[] getNameCascades(java.lang.String fqName)
          Utility routine to take a fully-qualified name, and split it into "cascades".
protected static java.lang.String[] getNameParts(java.lang.String fqName)
          Utility routine to take a fully-qualified name, and split it into its parts.
 java.util.Collection getPackages(java.lang.String packagePrefix)
          Fetch the list of subpackages within the given package.
protected abstract  void getPackages(java.lang.String packagePrefix, java.util.Collection out)
          Fetch the list of subpackages within the given package, adding them to the out collection provided.
 java.util.Collection<java.net.URL> getResourceURLs(java.lang.String resourceName)
          Fetch all the URL's for the Java resource file given the resource name.
static java.lang.String[] getStringArray(java.util.Collection collection)
          Convert a collection of Strings into a String array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.jdeveloper.java.JavaClassLocator
buildIndex, getClassURL, getSourceURL, getURL
 
Methods inherited from interface oracle.jdeveloper.java.JavaResourceLocator
getClassURL, getResourceURL
 

Field Detail

EMPTY_LOCATOR

public static final BaseClassLocator EMPTY_LOCATOR
Locator implementation that does nothing.


EMPTY_STRING_ARRAY

public static final java.lang.String[] EMPTY_STRING_ARRAY
Singleton empty list.


EMPTY_COLLECTION

public static final java.util.Collection EMPTY_COLLECTION
Singleton empty collection.

Constructor Detail

BaseClassLocator

public BaseClassLocator()
Method Detail

getResourceURLs

public java.util.Collection<java.net.URL> getResourceURLs(java.lang.String resourceName)
Description copied from interface: JavaResourceLocator
Fetch all the URL's for the Java resource file given the resource name. This should include the full path of the resource.

Specified by:
getResourceURLs in interface JavaResourceLocator
Parameters:
resourceName - the full name of the resource including any file extensions
Returns:
the collection of Java resource URL's, may be empty but not null.

getPackages

public java.util.Collection 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.

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

getPackages

protected abstract void getPackages(java.lang.String packagePrefix,
                                    java.util.Collection out)
Fetch the list of subpackages within the given package, adding them to the out collection provided.

Parameters:
packagePrefix - the package prefix, i.e., "java.io"
out - the collection to add the packages

getClassesInPackage

public java.util.Collection 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.

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

getClassesInPackage

protected abstract void getClassesInPackage(java.lang.String packagePrefix,
                                            java.util.Collection out)
Fetch the list of top-level classes within the given package, adding them to the out collection provided.

Parameters:
packagePrefix - the package prefix, i.e., "java.io"
out - the collection to add the class names

getAllClasses

public java.util.Collection 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".

Specified by:
getAllClasses in interface JavaClassLocator
Returns:
a collection of (String) fully-qualified class names known by this locator

getAllClasses

public java.util.Collection 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".

Specified by:
getAllClasses in interface JavaClassLocator
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

getAllClasses

protected abstract void getAllClasses(java.util.Collection out,
                                      ClassNameFilter filter)
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".

Parameters:
out - the collection to add the fully-qualified class names
filter - the class name filter to use

getAllPackages

public java.util.Collection 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 "".

Specified by:
getAllPackages in interface JavaClassLocator
Returns:
a collection of (String) full package names known by this lcoator

getAllPackages

public java.util.Collection 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 "".

Specified by:
getAllPackages in interface JavaClassLocator
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

getAllPackages

protected abstract void getAllPackages(java.util.Collection out,
                                       PackageNameFilter filter)
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 "".

Parameters:
out - the collection to add the full package names
filter - the pckage name filter to use

getClassesByName

public java.util.Collection 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".

Specified by:
getClassesByName in interface JavaClassLocator
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

public java.util.Collection 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.

Specified by:
getClassesByPrefix in interface JavaClassLocator
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

ensureValid

protected static BaseClassLocator ensureValid(BaseClassLocator locator)
Utility routine to ensure that there is a valid locator available. If the given locator is null, then an empty implementation is supplied.

Parameters:
locator - the locator to ensure is valid

addToCollection

public static void addToCollection(java.lang.Object[] array,
                                   java.util.Collection collection)
Add an array of objects to a collection.

Parameters:
array - the array of objects
collection - the collection to add to

getStringArray

public static java.lang.String[] getStringArray(java.util.Collection collection)
Convert a collection of Strings into a String array.

Parameters:
collection - the collection of Strings
Returns:
a String array containing the Strings from the collection

buildFQName

public static java.lang.String buildFQName(java.lang.String packagePrefix,
                                           java.lang.String className)
Utility routine to build a fully-qualified name.

Parameters:
packagePrefix - the package prefix to use
className - the class name to use

getNameParts

protected static java.lang.String[] getNameParts(java.lang.String fqName)
Utility routine to take a fully-qualified name, and split it into its parts. For example, "java.io.IOException" would be split into { "java", "io", "IOException" }.


getNameCascades

protected static java.lang.String[] getNameCascades(java.lang.String fqName)
Utility routine to take a fully-qualified name, and split it into "cascades". For example, "java.io.IOException" would be split into { "java", "java.io", "java.io.IOException" }.


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

E13403-02

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