Package javassist

Examples of javassist.ClassPool.appendClassPath()


      ClassPool pool = new ClassPool();
      ClassPath deploymentPath = new DeploymentUnitClassPath(unit);
      pool.appendClassPath(deploymentPath);
      // fall back to classloader classpath
      ClassPath classPath = new LoaderClassPath(unit.getClassLoader());
      pool.appendClassPath(classPath);
      return pool;
   }

   /**
    * Visit module.
View Full Code Here


    }
   
    public static ClassPool newClassPool() {
        ClassPool classPool = new ClassPool();
        classPool.appendSystemPath();
        classPool.appendClassPath(new LoaderClassPath(Enhancer.class.getClassLoader()));
        classPool.appendClassPath(new ApplicationClassesClasspath());
        return classPool;
    }

    /**
 
View Full Code Here

   
    public static ClassPool newClassPool() {
        ClassPool classPool = new ClassPool();
        classPool.appendSystemPath();
        classPool.appendClassPath(new LoaderClassPath(Enhancer.class.getClassLoader()));
        classPool.appendClassPath(new ApplicationClassesClasspath());
        return classPool;
    }

    /**
     * Construct a javassist CtClass from an application class.
View Full Code Here

    }

    public static ClassPool newClassPool() {
        ClassPool classPool = new ClassPool();
        classPool.appendSystemPath();
        classPool.appendClassPath(new LoaderClassPath(Enhancer.class.getClassLoader()));
        classPool.appendClassPath(new ApplicationClassesClasspath());
        return classPool;
    }

    /**
 
View Full Code Here

    public static ClassPool newClassPool() {
        ClassPool classPool = new ClassPool();
        classPool.appendSystemPath();
        classPool.appendClassPath(new LoaderClassPath(Enhancer.class.getClassLoader()));
        classPool.appendClassPath(new ApplicationClassesClasspath());
        return classPool;
    }

    /**
     * Construct a javassist CtClass from an application class.
View Full Code Here

    @Override
    public Class<?> doCompile(String name, String source) throws Throwable {
        int i = name.lastIndexOf('.');
        String className = i < 0 ? name : name.substring(i + 1);
        ClassPool pool = new ClassPool(true);
        pool.appendClassPath(new LoaderClassPath(ClassHelper.getCallerClassLoader(getClass())));
        Matcher matcher = IMPORT_PATTERN.matcher(source);
        List<String> importPackages = new ArrayList<String>();
        Map<String, String> fullNames = new HashMap<String, String>();
        while (matcher.find()) {
            String pkg = matcher.group(1);
View Full Code Here

    ClassPool pool = POOL_MAP.get(loader);
    if( pool == null )
    {
      pool = new ClassPool(true);
      pool.appendClassPath(new LoaderClassPath(loader));
      POOL_MAP.put(loader, pool);
    }
    return pool;
  }
View Full Code Here

  }

  @Nonnull
  protected static CtClass getCtClass( @Nonnull final ClassLoader loader, @Nonnull String className ) throws NotFoundException {
    final ClassPool pool = new ClassPool(true);
    pool.appendClassPath(new LoaderClassPath(loader));

    return pool.get(className);
  }

  protected static void insertAssertedVerificationCodeBefore( @Nonnull CtMethod method, @Nonnull String verificationCode ) throws CannotCompileException {
View Full Code Here

  public ClassFile( @Nonnull final File classFile, @Nonnull ClassLoader dependenciesClassLoader) throws IOException {
    this.classFile = classFile;
    this.dependenciesClassLoader = dependenciesClassLoader;
    final ClassPool classPool = new ClassPool(true);
    classPool.appendClassPath(new LoaderClassPath(dependenciesClassLoader));

    final InputStream inputStream = new BufferedInputStream( new FileInputStream( classFile ) );
    try {
      compiledClass = classPool.makeClass( inputStream );
    } finally {
View Full Code Here

      cacheClassLoader.get(classLoader).add(chieldClassName);
     
      ClassPool pool = new ClassPool();
      CtClass ctChieldClass = pool.getOrNull(chieldClassName);

      pool.appendClassPath(new LoaderClassPath(classLoader));
      CtClass ctSuperClass = pool.get(superClassName);

      ctChieldClass = pool.getAndRename(ConfigurationImpl.class.getCanonicalName(), chieldClassName);
      ctChieldClass.setSuperclass(ctSuperClass);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.