public abstract class URLClassLocator extends BaseClassLocator
URLClassLocator
is an abstract starting point for a
JavaClassLocator
implementation based out of a root URL.
These implementations will attempt to locate either Java class files
or Java sources files (but not both simultaneously) within a given
root URL.
Note that that implementations based on the URLClassLocator is intended
to support only top-level classes.Modifier and Type | Field and Description |
---|---|
protected int |
_fileType
The file type we are searching for, either CLASS_TYPE or SOURCE_TYPE.
|
protected java.net.URL |
_rootURL
The root directory that we are based out of.
|
static java.lang.String[] |
CLASS_SUFFIXES
Default suffix for a *.class file.
|
static int |
CLASS_TYPE
Constant indicating that this locator is for Java classes.
|
static java.lang.String[] |
SOURCE_SUFFIXES
Default suffix for a *.java file.
|
static int |
SOURCE_TYPE
Constant indicating that this locator is for Java sources.
|
EMPTY_COLLECTION, EMPTY_LOCATOR, EMPTY_STRING_ARRAY
Constructor and Description |
---|
URLClassLocator(java.net.URL rootURL,
int fileType)
Constructs a new
URLClassLocator . |
Modifier and Type | Method and Description |
---|---|
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.
|
protected int |
getFileType()
Fetch the file type registered for this class locator.
|
protected java.net.URL |
getRootURL()
Fetch the root URL associated with this class locator.
|
java.net.URL |
getSourceURL(java.lang.String fqClassName)
Fetch the URL for the SourceFile for the given fully-qualified Java
class name.
|
protected boolean |
isClassTypeLocator()
Whether this locator is of CLASS_TYPE.
|
protected boolean |
isMatchingFileType(java.lang.String filename)
Utility routine which checks if the given filename matches the file
type registered for this class locator instance.
|
protected boolean |
isMatchingFileType(java.net.URL url)
Utility routine which checks if the given URL matches the file
type registered for this class locator instance.
|
protected boolean |
isSourceTypeLocator()
Whether this locator is of SOURCE_TYPE.
|
addToCollection, buildFQName, buildIndexInterruptibly, checkInterrupt, ensureValid, getAllClasses, getAllClasses, getAllClasses, getAllClassesInterruptibly, getAllClassesInterruptibly, getAllClassesInterruptibly, getAllPackages, getAllPackages, getAllPackages, getAllPackagesInterruptibly, getAllPackagesInterruptibly, getAllPackagesInterruptibly, getChildLocators, getClassesByName, getClassesByNameInterruptibly, getClassesByPrefix, getClassesByPrefixInterruptibly, getClassesDirectly, getClassesInPackage, getClassesInPackage, getClassesInPackageInterruptibly, getClassesInPackageInterruptibly, getClassURLInterruptibly, getNameCascades, getNameParts, getPackages, getPackages, getPackagesInterruptibly, getPackagesInterruptibly, getResourcesDirectly, getResourceURLs, getSourceLocator, getSourceURLInterruptibly, getStringArray, getURLInterruptibly, visitClasspathTree, visitClasspathTree, visitJavaTypes, visitJavaTypes, visitResources, visitResources
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
buildIndex, getURL
getResourceURL
protected java.net.URL _rootURL
protected int _fileType
public static final int CLASS_TYPE
public static final int SOURCE_TYPE
public static final java.lang.String[] CLASS_SUFFIXES
public static final java.lang.String[] SOURCE_SUFFIXES
public URLClassLocator(java.net.URL rootURL, int fileType)
URLClassLocator
.rootURL
- the root URL we are working withfileType
- the file type, either CLASS_TYPE or SOURCE_TYPEprotected java.net.URL getRootURL()
protected int getFileType()
protected boolean isSourceTypeLocator()
protected boolean isClassTypeLocator()
protected boolean isMatchingFileType(java.net.URL url)
url
- the URL of the file to checkprotected boolean isMatchingFileType(java.lang.String filename)
filename
- the name of the file to checkpublic java.net.URL getSourceURL(java.lang.String fqClassName)
fqClassName
- the fully-qualified class name in dotted notationpublic java.net.URL getClassURL(java.lang.String fqClassName)
fqClassName
- the fully-qualified class name in dotted notationprotected java.lang.Object getClasspathTreeNode()
BaseClassLocator
getClasspathTreeNode
in class BaseClassLocator
null
if there is no classpath
tree node corresponding to this locatorClasspathTree