Package javassist

Examples of javassist.CtMethod.insertAfter()


      // add behavior to HasHTML.setHTML method
      try {
         CtMethod setHTML = c.getDeclaredMethod("setHTML", setArgs);
         addHTMLField(c);
         setHTML.insertBefore("this.instrument_oldHTML = this.getHTML();");
         setHTML.insertAfter(GwtFinder.class.getName()
                  + ".onSetHTML(this, $1, this.instrument_oldHTML);");
      } catch (NotFoundException e) {
         // don't instrument method if not existing
      }
   }
View Full Code Here


      // add behavior to HasHTML.setHTML method
      try {
         CtMethod setText = c.getDeclaredMethod("setText", setArgs);
         addTextField(c);
         setText.insertBefore("this.instrument_oldText = this.getText();");
         setText.insertAfter(GwtFinder.class.getName()
                  + ".onSetText(this, $1, this.instrument_oldText);");
      } catch (NotFoundException e) {
         // don't instrument method if not existing
      }
   }
View Full Code Here

      // add behavior to HasHTML.setHTML method
      try {
         CtMethod setName = c.getDeclaredMethod("setName", setArgs);
         addTextField(c);
         setName.insertBefore("this.instrument_oldName = this.getName();");
         setName.insertAfter(GwtFinder.class.getName()
                  + ".onSetName(this, $1, this.instrument_oldName);");
      } catch (NotFoundException e) {
         // don't instrument method if not existing
      }
   }
View Full Code Here

class ListWrapperPatcher {

   @InitMethod
   static void initClass(CtClass c) throws CannotCompileException, NotFoundException {
      CtMethod flushMethod = c.getDeclaredMethod("flush");
      flushMethod.insertAfter(BrowserSimulatorImpl.class.getName() + ".get().fireLoopEnd();");
   }

}
View Full Code Here

      fireNativeEvent.insertBefore(BrowserSimulatorImpl.class.getName() + ".get().fireLoopEnd(); "
               + DomEventPatcher.class.getName() + ".triggerNativeEvent($1, $3);");

      // fire browser event loop at the end because some command may have been scheduled or RPC call
      // made when the event was dispatched.
      fireNativeEvent.insertAfter(BrowserSimulatorImpl.class.getName() + ".get().fireLoopEnd();");
   }

}
View Full Code Here

         initialiseInfosForInstanceCode.insert(0, genadvisor.getName() + " classAdvisor = (" + genadvisor.getName() + ")" + clazz.getName() + "." + GET_CLASS_ADVISOR + "();");
      }
      addCodeToInitialiseMethod(genInstanceAdvisor, initialiseInfosForInstanceCode.toString(), INITIALISE_INFOS_FOR_INSTANCE);
     
      CtMethod advicesUpdated = genInstanceAdvisor.getDeclaredMethod(ADVICES_UPDATED);
      advicesUpdated.insertAfter(advicesUpdatedCode.toString());
     
      CtMethod lockWriteChains = genInstanceAdvisor.getDeclaredMethod(LOCK_WRITE_CHAINS);
      lockWriteChains.insertAfter(lockWriteChainsCode.toString());
      CtMethod unlockWriteChains = genInstanceAdvisor.getDeclaredMethod(UNLOCK_WRITE_CHAINS);
      unlockWriteChains.insertAfter(unlockWriteChainsCode.toString());
View Full Code Here

     
      CtMethod advicesUpdated = genInstanceAdvisor.getDeclaredMethod(ADVICES_UPDATED);
      advicesUpdated.insertAfter(advicesUpdatedCode.toString());
     
      CtMethod lockWriteChains = genInstanceAdvisor.getDeclaredMethod(LOCK_WRITE_CHAINS);
      lockWriteChains.insertAfter(lockWriteChainsCode.toString());
      CtMethod unlockWriteChains = genInstanceAdvisor.getDeclaredMethod(UNLOCK_WRITE_CHAINS);
      unlockWriteChains.insertAfter(unlockWriteChainsCode.toString());
   }

   private String addAdvicesUpdatedForJoinpointField(String infoName) throws NotFoundException, CannotCompileException
View Full Code Here

      advicesUpdated.insertAfter(advicesUpdatedCode.toString());
     
      CtMethod lockWriteChains = genInstanceAdvisor.getDeclaredMethod(LOCK_WRITE_CHAINS);
      lockWriteChains.insertAfter(lockWriteChainsCode.toString());
      CtMethod unlockWriteChains = genInstanceAdvisor.getDeclaredMethod(UNLOCK_WRITE_CHAINS);
      unlockWriteChains.insertAfter(unlockWriteChainsCode.toString());
   }

   private String addAdvicesUpdatedForJoinpointField(String infoName) throws NotFoundException, CannotCompileException
   {
      String updatedAdvicesName = updatedAdvicesName(infoName);
View Full Code Here

   private void addCodeToInitialiseMethod(CtClass clazz, String code, String methodName) throws NotFoundException
   {
      CtMethod method = clazz.getDeclaredMethod(methodName);
      try
      {
         method.insertAfter(code);
      }
      catch (CannotCompileException e)
      {
         e.printStackTrace();
         throw new RuntimeException("code was: " + code + " for method " + method.getName());
View Full Code Here

         initialiseInfosForInstanceCode.insert(0, genadvisor.getName() + " classAdvisor = (" + genadvisor.getName() + ")" + clazz.getName() + "." + GET_CLASS_ADVISOR + "();");
      }
      addCodeToInitialiseMethod(genInstanceAdvisor, initialiseInfosForInstanceCode.toString(), INITIALISE_INFOS_FOR_INSTANCE);
     
      CtMethod advicesUpdated = genInstanceAdvisor.getDeclaredMethod(ADVICES_UPDATED);
      advicesUpdated.insertAfter(advicesUpdatedCode.toString());
     
      CtMethod lockWriteChains = genInstanceAdvisor.getDeclaredMethod(LOCK_WRITE_CHAINS);
      lockWriteChains.insertAfter(lockWriteChainsCode.toString());
      CtMethod unlockWriteChains = genInstanceAdvisor.getDeclaredMethod(UNLOCK_WRITE_CHAINS);
      unlockWriteChains.insertAfter(unlockWriteChainsCode.toString());
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.