Class ScopedClassPool

    • Field Detail

      • classLoader

        protected java.lang.ref.Reference<java.lang.ClassLoader> classLoader
      • softcache

        protected java.util.Map<java.lang.String,​CtClass> softcache
    • Constructor Detail

      • ScopedClassPool

        protected ScopedClassPool​(java.lang.ClassLoader cl,
                                  ClassPool src,
                                  ScopedClassPoolRepository repository)
        Create a new ScopedClassPool.
        Parameters:
        cl - the classloader
        src - the original class pool
        repository - the repository
      • ScopedClassPool

        protected ScopedClassPool​(java.lang.ClassLoader cl,
                                  ClassPool src,
                                  ScopedClassPoolRepository repository,
                                  boolean isTemp)
        Create a new ScopedClassPool.
        Parameters:
        cl - the classloader
        src - the original class pool
        repository - the repository
        isTemp - Whether this is a temporary pool used to resolve references
    • Method Detail

      • getClassLoader0

        protected java.lang.ClassLoader getClassLoader0()
      • close

        public void close()
        Close the class pool
      • flushClass

        public void flushClass​(java.lang.String classname)
        Flush a class
        Parameters:
        classname - the class to flush
      • soften

        public void soften​(CtClass clazz)
        Soften a class
        Parameters:
        clazz - the class
      • isUnloadedClassLoader

        public boolean isUnloadedClassLoader()
        Whether the classloader is loader
        Returns:
        false always
      • lockInCache

        public void lockInCache​(CtClass c)
        Lock a class into the cache
        Parameters:
        c - the class
      • getCachedLocally

        protected CtClass getCachedLocally​(java.lang.String classname)
        Whether the class is cached in this pooled
        Parameters:
        classname - the class name
        Returns:
        the cached class
      • getLocally

        public CtClass getLocally​(java.lang.String classname)
                           throws NotFoundException
        Get any local copy of the class
        Parameters:
        classname - the class name
        Returns:
        the class
        Throws:
        NotFoundException - when the class is not found
      • toClass

        public java.lang.Class<?> toClass​(CtClass ct,
                                          java.lang.ClassLoader loader,
                                          java.security.ProtectionDomain domain)
                                   throws CannotCompileException
        Convert a javassist class to a java class
        Overrides:
        toClass in class ClassPool
        Parameters:
        ct - the javassist class
        loader - the loader
        domain - the protection domain for the class. If it is null, the default domain created by java.lang.ClassLoader is used.
        Throws:
        CannotCompileException - for any error
        See Also:
        ClassPool.getClassLoader()