Package javassist

Examples of javassist.ClassClassPath


   * @throws CannotCompileException
   */
  private static Class getGraphTypeFactoryByClassName(String vidClassName,
      String vdataClassName, String edataClassName) throws NotFoundException,
      CannotCompileException {
    pool.insertClassPath(new ClassClassPath(GraphTypeFactory.class));
    CtClass ctFactory = pool.get(GraphTypeFactory.class.getName());
    ctFactory.setName("generatedclass.MyGraphTypeFactory" + factoryid);
    factoryid++;
    CtClass ctSuperFactory = pool.get(GraphTypeFactory.class.getName());
    ctFactory.setSuperclass(ctSuperFactory);
View Full Code Here


      return classfileBuffer;
    }

    final ClassPool cp = new ClassPool();
    cp.appendSystemPath();
    cp.appendClassPath( new ClassClassPath( this.getClass() ) );
    cp.appendClassPath( new ClassClassPath( classfile.getClass() ) );

    try {
      cp.makeClassIfNew( new ByteArrayInputStream( classfileBuffer ) );
    }
    catch (IOException e) {
View Full Code Here

      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
      ClassLoader cherryPickCl = new CherryPickClassLoader(included, null, tccl);
      Thread.currentThread().setContextClassLoader(cherryPickCl);
      ClassPool pool = ClassPool.getDefault();
      // Insert a classpath so that Maven does not complain about not finding the class
      pool.insertClassPath(new ClassClassPath(Car.class));
      CtClass carCt = pool.get(CAR);
      try {
         carCt.addField(CtField.make("public int year;", carCt));
         Class carClass = carCt.toClass();
         if (isNewExternalizer) {
View Full Code Here

      urls = paths.toArray(new URL[paths.size()]);
      ClassLoader poolLoader = new URLClassLoader(urls, EmptyClassLoader.EMPTY);
     
      ClassPool pool = new ClassPool(false);
      pool.appendClassPath(new CheckerClassPath(poolLoader));
      pool.appendClassPath(new ClassClassPath(Object.class));
     
      //Add all the classes to compile
      for (File f : files)
      {
         if (f.isDirectory())
View Full Code Here

          // TODO: do we really need this check here?
            assureTypeIsAccessible(this.getClass());
           
            Boolean existing = superClasses.put(sourceCode.getSuperClass(), true);
            if (existing==null || !existing) {
                classPool.insertClassPath(new ClassClassPath(sourceCode.getSuperClass()));
            }
           
            if (registerClassLoader(Thread.currentThread().getContextClassLoader())) {
              classPool.insertClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));
            }
View Full Code Here

         }
      }

      // Init the Javassist class pool.
      classPool = ClassPool.getDefault();
      classPool.insertClassPath(new ClassClassPath(RhqPluginXmlGenerator.class));
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      dbf.setNamespaceAware(true);
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document doc = db.newDocument();
      Element root = doc.createElement("plugin");
View Full Code Here

      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
      ClassLoader cherryPickCl = new CherryPickClassLoader(included, null, tccl);
      Thread.currentThread().setContextClassLoader(cherryPickCl);
      ClassPool pool = ClassPool.getDefault();
      // Insert a classpath so that Maven does not complain about not finding the class
      pool.insertClassPath(new ClassClassPath(Car.class));
      CtClass carCt = pool.get(CAR);
      try {
         carCt.addField(CtField.make("public int year;", carCt));
         Class carClass = carCt.toClass();
         if (isNewExternalizer) {
View Full Code Here


    protected InstrumentationModelFinder() throws NotFoundException, ClassNotFoundException {
        ClassPool pool = ClassPool.getDefault();
        //any simple class will do here, but Model - it causes slf4j to be loaded during instrumentation.
        pool.insertClassPath(new ClassClassPath(Class.forName("org.javalite.activejdbc.Association")));
        modelClass = pool.get("org.javalite.activejdbc.Model");
    }
View Full Code Here

  }
 
  @Override
  public void execute(Set<File> files) {
    ClassPool cp = ClassPool.getDefault();
    cp.insertClassPath(new ClassClassPath(this.getClass()));
    try {
      for (File file : files) {
        cp.makeClass(new FileInputStream(file));
      }
    } catch (IOException e) {
View Full Code Here

TOP

Related Classes of javassist.ClassClassPath

Copyright © 2018 www.massapicom. 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.