Package javassist

Examples of javassist.ClassPool


        
         else
         {
            //We need to do all the work again
            AspectManager manager = AspectManager.instance();
            ClassPool pool = manager.findClassPool(classloader);
            ProtectionDomain pd = advisorClass.getProtectionDomain();
            generatedClass = generateJoinpointClass(pool, info, classloader, pd);
            generatedJoinPointClassCache.put(infoAdviceString, generatedClass);
         }
         Object obj = generatedClass.createJoinPointInstance(classloader, info);
View Full Code Here


  private ClassPool classPool ;


  public JavassistClassInformation() {
    classPool = new ClassPool();
  }
View Full Code Here

    */
   public static CtClass getCtClass(Class clazz)
   {
      try
      {
         ClassPool pool = repository.findClassPool(clazz.getClassLoader());
         return pool.get(clazz.getName());
      }
      catch (NotFoundException e)
      {
         throw new RuntimeException("Unable to load CtClass for " + clazz, e);
      }
View Full Code Here

   }

   public void weave() throws NotFoundException, IOException
   {

      ClassPool pool = ClassPool.getDefault();
      try
      {
         pool.appendPathList(weaver.getClasspath());
      }
      catch (NotFoundException nfe)
      {
         throw new IOException(nfe.getMessage());
      }
View Full Code Here

    catch (IOException e) {
      LOG.unableToBuildEnhancementMetamodel( className );
      return classfileBuffer;
    }
    // This is the same as ClassPool.getDefault() but ensures a new ClassPool per
    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) {
      throw new RuntimeException(e.getMessage(), e);
    }
    FieldTransformer transformer = getFieldTransformer( classfile, cp );
    if ( transformer != null ) {
View Full Code Here

  private ClassLoader parent;
  private ClassPool classPool;

  /*package*/ TransformingClassLoader(ClassLoader parent, String[] classpath) {
    this.parent = parent;
    classPool = new ClassPool( true );
    for ( int i = 0; i < classpath.length; i++ ) {
      try {
        classPool.appendClassPath( classpath[i] );
      }
      catch ( NotFoundException e ) {
View Full Code Here

     * includes both the exceptions that the try-catch statements including the
     * expression can catch and the exceptions that the throws declaration
     * allows the method to throw.
     */
    public CtClass[] mayThrow() {
        ClassPool pool = thisClass.getClassPool();
        ConstPool cp = thisMethod.getConstPool();
        LinkedList list = new LinkedList();
        try {
            CodeAttribute ca = thisMethod.getCodeAttribute();
            ExceptionTable et = ca.getExceptionTable();
            int pos = currentPos;
            int n = et.size();
            for (int i = 0; i < n; ++i)
                if (et.startPc(i) <= pos && pos < et.endPc(i)) {
                    int t = et.catchType(i);
                    if (t > 0)
                        try {
                            addClass(list, pool.get(cp.getClassInfo(t)));
                        }
                        catch (NotFoundException e) {
                        }
                }
        }
        catch (NullPointerException e) {
        }

        ExceptionsAttribute ea = thisMethod.getExceptionsAttribute();
        if (ea != null) {
            String[] exceptions = ea.getExceptions();
            if (exceptions != null) {
                int n = exceptions.length;
                for (int i = 0; i < n; ++i)
                    try {
                        addClass(list, pool.get(exceptions[i]));
                    }
                    catch (NotFoundException e) {
                    }
            }
        }
View Full Code Here

      if (found == null || found == module)
      {
         return null;
      }
      ClassLoader foundLoader = registry.getClassLoader(found);
      ClassPool pool = manager.findClassPool(foundLoader);
      try
      {
         if (pool instanceof BaseClassPool)
         {
            return getCachedOrCreateFromPool((BaseClassPool)pool, classname, true, trace);
         }
         return pool.get(classname);
      }
      catch(NotFoundException e)
      {
      }
      return null;
View Full Code Here

      this.registerModuleCallback = registerModuleCallback;
   }
  
   public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository)
   {
      ClassPool parent = getCreateParentClassPools(cl, src, repository);
     
      if (cl instanceof RealClassLoader)
      {
         Module module = registry.getModule(cl);
         if (module == null)
View Full Code Here

         if (parentDomainName == null)
         {
            ClassLoader parentUnitLoader = registry.getParentUnitLoader(cl);
            if (parentUnitLoader != null)
            {
               ClassPool parentUnitPool = AspectManager.getTopLevelAspectManager().registerClassLoader(parentUnitLoader);
               parentPoolDomain = new ClassPoolToClassPoolDomainAdapter(parentUnitPool);
            }
         }
         poolDomain = new JBossClClassPoolDomain(domain.getName(), parentPoolDomain, domain.getParentPolicy(), registry);
        
View Full Code Here

TOP

Related Classes of javassist.ClassPool

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.