Package javassist

Examples of javassist.CodeConverter


    */
   public void convertProcessedClasses(HotSwapper hotSwapper, CtClass clazz,
         Collection<CtField> fieldReads, Collection<CtField> fieldWrites, boolean constructor)
   {
      ClassPool classPool = clazz.getClassPool();
      CodeConverter codeConverter = new CodeConverter();
      for (CtField field : fieldReads)
      {
         codeConverter.replaceFieldRead(field, clazz, FieldAccessTransformer.fieldRead(field.getName()));
      }
      for (CtField field : fieldWrites)
      {
         codeConverter.replaceFieldWrite(field, clazz, FieldAccessTransformer.fieldWrite(field.getName()));
      }
      if (constructor)
      {
         codeConverter.replaceNew(clazz, clazz, ConstructorExecutionTransformer.constructorFactory(clazz.getSimpleName()));
      }

      synchronized(processedClasses)
      {
      for (CtClass processedClass : processedClasses)
View Full Code Here


    * @return
    * @throws NotFoundException
    */
   public boolean replaceFieldAccess(List<CtField> fields, CtClass clazz, ClassAdvisor fieldsAdvisor) throws NotFoundException
   {
      CodeConverter converter = instrumentor.getCodeConverter();
      boolean converted = false;
      for (CtField field : fields)
      {
         if (!Modifier.isPrivate(field.getModifiers()) && Advisable.isAdvisable(field))
         {
            JoinpointClassification fieldGetClassification = classifier.classifyFieldGet(field, fieldsAdvisor);

            if (fieldGetClassification.equals(JoinpointClassification.WRAPPED))
            {
               converted = true;
               converter.replaceFieldRead(field, clazz, fieldRead(field.getName()));
            }
            JoinpointClassification fieldSetClassification = classifier.classifyFieldSet(field, fieldsAdvisor);
            if (fieldSetClassification.equals(JoinpointClassification.WRAPPED))
            {
               converted = true;
               converter.replaceFieldWrite(field, clazz, fieldWrite(field.getName()));
            }
         }
      }
      return converted;
   }
View Full Code Here

         AspectManager manager,
         JoinpointClassifier joinpointClassifier,
         DynamicTransformationObserver observer)
   {
      this.classPool = pool;
      this.converter = new CodeConverter();
      this.manager = manager;
      this.joinpointClassifier = joinpointClassifier;
      this.dynamicTransformationObserver = observer;
      intitialiseTransformers();
   }
View Full Code Here

    * @param joinpointUpdates a collection of <code>org.jboss.aop.instrument.JoinpointStatusUpdate</code>.
    * @param hotSwapper object capable of hot swapping classes.
    */
   public synchronized void interceptorChainsUpdated(Collection joinpointUpdates, HotSwapper hotSwapper) {
      //creates a converter
      this.converter = new CodeConverter();
      // list of instrumented classes
      Collection classes = new HashSet();
      try {
         // transform classes whose joinpont status have changed
         for (Iterator iterator = joinpointUpdates.iterator(); iterator.hasNext(); )
View Full Code Here

    */
   public void convertProcessedClasses(HotSwapper hotSwapper, CtClass clazz,
         Collection fieldReads, Collection fieldWrites, boolean constructor)
   {
      AOPClassPool classPool = (AOPClassPool) clazz.getClassPool();
      CodeConverter codeConverter = new CodeConverter();
      for (Iterator iterator = fieldReads.iterator(); iterator.hasNext(); )
      {
         CtField field = (CtField) iterator.next();
         codeConverter.replaceFieldRead(field, clazz, fieldAccessTransformer.fieldRead(field.getName()));
      }
      for (Iterator iterator = fieldWrites.iterator(); iterator.hasNext(); )
      {
         CtField field = (CtField) iterator.next();
         codeConverter.replaceFieldWrite(field, clazz, fieldAccessTransformer.fieldWrite(field.getName()));
      }
      if (constructor)
      {
         codeConverter.replaceNew(clazz, clazz, ConstructorExecutionTransformer.constructorFactory(clazz.getSimpleName()));
      }
        
      synchronized(processedClasses)
      {
      for (Iterator iterator = processedClasses.iterator(); iterator.hasNext();)
View Full Code Here

    * @return
    * @throws NotFoundException
    */
   public boolean replaceFieldAccess(List fields, CtClass clazz, ClassAdvisor fieldsAdvisor) throws NotFoundException
   {
      CodeConverter converter = instrumentor.getCodeConverter();
      boolean converted = false;
      Iterator it = fields.iterator();
      while (it.hasNext())
      {
         CtField field = (CtField) it.next();
         if (!Modifier.isPrivate(field.getModifiers()) && Advisable.isAdvisable(field))
         {
            JoinpointClassification fieldGetClassification = classifier.classifyFieldGet(field, fieldsAdvisor);

            if (fieldGetClassification.equals(JoinpointClassification.WRAPPED))
            {
               converted = true;
               converter.replaceFieldRead(field, clazz, fieldRead(field.getName()));
            }
            JoinpointClassification fieldSetClassification = classifier.classifyFieldSet(field, fieldsAdvisor);
            if (fieldSetClassification.equals(JoinpointClassification.WRAPPED))
            {
               converted = true;
               converter.replaceFieldWrite(field, clazz, fieldWrite(field.getName()));
            }
         }
      }
      return converted;
   }
View Full Code Here

TOP

Related Classes of javassist.CodeConverter

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.