edu.umd.cs.findbugs
Class URLClassPathRepository

java.lang.Object
  extended by edu.umd.cs.findbugs.URLClassPathRepository
All Implemented Interfaces:
java.io.Serializable, org.apache.bcel.util.Repository

public class URLClassPathRepository
extends java.lang.Object
implements org.apache.bcel.util.Repository

BCEL Repository implementation that uses an URLClassPath to find classes. This class has two specific improvements over BCEL's SyntheticRepository class:

  1. Classpath elements may be added at any time, not just when the object is created.
  2. Classpath elements can be URLs. This allows repository lookups to find classes via http URLs, jar URLs, etc.
FindBugs requires and uses both of these capabilities.

Author:
David Hovemeyer
See Also:
Serialized Form

Field Summary
private  java.util.Map<java.lang.String,org.apache.bcel.classfile.JavaClass> nameToClassMap
           
private  URLClassPath urlClassPath
           
 
Constructor Summary
URLClassPathRepository()
           
 
Method Summary
 void addSystemClasspathComponents()
          Add components of system classpath.
 void addURL(java.lang.String fileName)
          Add a filename or URL to the classpath.
 void clear()
           
 org.apache.bcel.classfile.JavaClass findClass(java.lang.String className)
           
 org.apache.bcel.util.ClassPath getClassPath()
           
 org.apache.bcel.classfile.JavaClass loadClass(java.lang.Class clazz)
           
 org.apache.bcel.classfile.JavaClass loadClass(java.lang.String className)
           
 void removeClass(org.apache.bcel.classfile.JavaClass javaClass)
           
 void storeClass(org.apache.bcel.classfile.JavaClass javaClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nameToClassMap

private java.util.Map<java.lang.String,org.apache.bcel.classfile.JavaClass> nameToClassMap

urlClassPath

private URLClassPath urlClassPath
Constructor Detail

URLClassPathRepository

public URLClassPathRepository()
Method Detail

addURL

public void addURL(java.lang.String fileName)
            throws java.io.IOException
Add a filename or URL to the classpath.

Parameters:
fileName - filename or URL of classpath entry to add
Throws:
java.io.IOException

addSystemClasspathComponents

public void addSystemClasspathComponents()
                                  throws java.io.IOException
Add components of system classpath.

Throws:
java.io.IOException

storeClass

public void storeClass(org.apache.bcel.classfile.JavaClass javaClass)
Specified by:
storeClass in interface org.apache.bcel.util.Repository

removeClass

public void removeClass(org.apache.bcel.classfile.JavaClass javaClass)
Specified by:
removeClass in interface org.apache.bcel.util.Repository

findClass

public org.apache.bcel.classfile.JavaClass findClass(java.lang.String className)
Specified by:
findClass in interface org.apache.bcel.util.Repository

loadClass

public org.apache.bcel.classfile.JavaClass loadClass(java.lang.String className)
                                              throws java.lang.ClassNotFoundException
Specified by:
loadClass in interface org.apache.bcel.util.Repository
Throws:
java.lang.ClassNotFoundException

loadClass

public org.apache.bcel.classfile.JavaClass loadClass(java.lang.Class clazz)
                                              throws java.lang.ClassNotFoundException
Specified by:
loadClass in interface org.apache.bcel.util.Repository
Throws:
java.lang.ClassNotFoundException

clear

public void clear()
Specified by:
clear in interface org.apache.bcel.util.Repository

getClassPath

public org.apache.bcel.util.ClassPath getClassPath()
Specified by:
getClassPath in interface org.apache.bcel.util.Repository