Package javassist

Examples of javassist.CtMethod.insertAfter()


         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

         superClass = superClass.getSuperclass();
         superAdvisor = superAdvisor.getSuperclass();
      }

      CtMethod advicesUpdated = genInstanceAdvisor.getDeclaredMethod(ADVICES_UPDATED);
      advicesUpdated.insertAfter(advicesUpdatedCode.toString());
   }

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

   private void addCodeToInitialiseMethod(String code, String methodName) throws NotFoundException
   {
      CtMethod method = genadvisor.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

            }
          }
          try {
            ctClass.getSuperclass().getMethod(added.getName(), "()V");
          } catch (NotFoundException ignore) {
            runConstructors.insertAfter(added.getName() + "();");
          }
        }
        if (added.getName().startsWith("staticConstruct")) {
          ctClass.makeClassInitializer().insertAfter("{ " + added.getName() + "(); }");
        }
View Full Code Here

        ctClass.addField(new CtField(classPool.get("boolean"), "isConstructed", ctClass), CtField.Initializer.constant(false));
        for (CtBehavior ctBehavior : ctClass.getDeclaredConstructors()) {
          ctBehavior.insertAfter("{ if(!this.isConstructed) { this.isConstructed = true; this.runConstructors(); } }");
        }
      }
      runConstructors.insertAfter(initialise);
    }
  }

  @Patch(
      requiredAttributes = "field"
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.