Package javassist

Examples of javassist.ClassPool.appendClassPath()


  private ClassPool buildClassPool(EnhancementContext enhancementContext) {
    final ClassPool classPool = new ClassPool( false );
    final ClassLoader loadingClassLoader = enhancementContext.getLoadingClassLoader();
    if ( loadingClassLoader != null ) {
      classPool.appendClassPath( new LoaderClassPath( loadingClassLoader ) );
    }
    return classPool;
  }

  /**
 
View Full Code Here


        createImplementationClass(BASE_CLASS, "initial from base");

        ClassPool pool = new ClassPool(null);

        pool.appendSystemPath();
        pool.appendClassPath(classesDir.getAbsolutePath());

        CtClass ctClass = pool.makeClass(CLASS);

        ctClass.setSuperclass(pool.get(BASE_CLASS));
View Full Code Here

        if (args.length != 1) {
            throw new IllegalArgumentException("Expecting classpath as single argument");
        }

        ClassPool classPool = ClassPool.getDefault();
        classPool.appendClassPath(args[0]);

        PathMatchingResourcePatternResolver resResolver =
                new PathMatchingResourcePatternResolver(classPool.getClassLoader());
        CachingMetadataReaderFactory cachingMetadataReaderFactory = new CachingMetadataReaderFactory();
View Full Code Here

        for (Resource resource : resResolver.getResources("classpath*:org/apache/syncope/core/**/*.class")) {
            MetadataReader metadataReader = cachingMetadataReaderFactory.getMetadataReader(resource);
            if (metadataReader.getAnnotationMetadata().isAnnotated(Entity.class.getName())) {

                Class entity = Class.forName(metadataReader.getClassMetadata().getClassName());
                classPool.appendClassPath(new ClassClassPath(entity));
                CtClass ctClass = ClassPool.getDefault().get(entity.getName());
                if (ctClass.isFrozen()) {
                    ctClass.defrost();
                }
                ClassFile classFile = ctClass.getClassFile();
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

    componentLoader = Util.getClassloader(project, getLog());

    // Set up class pool with all the project dependencies and the project classes themselves
    ClassPool classPool = new ClassPool(true);
    classPool.appendClassPath(new LoaderClassPath(componentLoader));

    // Set up map to keep a report per class.
    Multimap<String, String> reportData = LinkedHashMultimap.create();

    // Determine where to write the missing meta data report file
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

  private ClassPool buildClassPool(EnhancementContext enhancementContext) {
    ClassPool classPool = new ClassPool( false );
    ClassLoader loadingClassLoader = enhancementContext.getLoadingClassLoader();
    if ( loadingClassLoader != null ) {
      classPool.appendClassPath( new LoaderClassPath( loadingClassLoader ) );
    }
    return classPool;
  }

  /**
 
View Full Code Here

    final File[] classFiles = directory.listFiles( classNameFilter );

    final Collection<ClassFile> classesFound = new ArrayList<ClassFile>();

    ClassPool classPool = new ClassPool( true );
    classPool.appendClassPath(new LoaderClassPath(classLoader));

    for ( final File file : classFiles ) {
      try {
        ClassFile classFile = new ClassFile( file, classLoader, classPool);
        classesFound.add( classFile );
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.