Class URLClassPathRepository

  • All Implemented Interfaces:
    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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean DEBUG  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addURL​(java.lang.String fileName)
      Add a filename or URL to the classpath.
      void clear()  
      void destroy()
      Clear the repository and close all underlying resources.
      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

      • DEBUG

        public static final boolean DEBUG
    • Constructor Detail

      • URLClassPathRepository

        public URLClassPathRepository()
    • Method Detail

      • destroy

        public void destroy()
        Clear the repository and close all underlying resources.
      • 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
      • 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