Examples of CtMethod


Examples of javassist.CtMethod

      try {
         ct.removeField(ct.getField("number"));
         Class clazz = ct.toClass();
         if (isNewExternalizer) {
            CtClass extCt = pool.get(HOUSE_EXT);
            CtMethod writeObjMeth = extCt.getMethod("writeObject", "(Ljava/io/ObjectOutput;Ljava/lang/Object;)V");
            writeObjMeth.setBody("{\n" +
               "$1.writeInt(0);\n" + // Safe the spot to avoid incompatibility
               "$1.writeObject((("  + HOUSE + ") $2).street);\n" +
            "}\n"
            );
            CtMethod readObjMeth = extCt.getMethod("readObject", "(Ljava/io/ObjectInput;)Ljava/lang/Object;");
            readObjMeth.setBody("{\n" +
               HOUSE + " o = new " + HOUSE + "();\n" +
               "try {\n" +
               "   $1.readInt();\n" +
               "} catch(java.io.OptionalDataException e) {}\n" +
               "o.street = (String) $1.readObject();\n" +
View Full Code Here

Examples of jp.co.smg.endosnipe.javassist.CtMethod

        if (behaviorList.size() > 0)
        {
            CtField field = CtField.make("private long createTimeJvn;", ctClass);
            ctClass.addField(field);

            CtMethod getServerInfoMethod = CtMethod.make("" + //
                    "public long getCreateTimeJvn(){ " + //
                    "        return this.createTimeJvn;" + //
                    "}", ctClass);
            ctClass.addMethod(getServerInfoMethod);
           
View Full Code Here

Examples of org.hotswap.agent.javassist.CtMethod

    Set<Object> registeredRBMaps = Collections.newSetFromMap(new WeakHashMap<Object, Boolean>());

    @OnClassLoadEvent(classNameRegexp = "com.sun.faces.config.ConfigManager")
    public static void facesConfigManagerInitialized(CtClass ctClass) throws NotFoundException, CannotCompileException {
        CtMethod init = ctClass.getDeclaredMethod("initialize");
        init.insertAfter(PluginManagerInvoker.buildInitializePlugin(JsfPlugin.class));
        LOGGER.debug("com.sun.faces.config.ConfigManager enhanced with plugin initialization.");
    }
View Full Code Here

Examples of org.jboss.forge.furnace.proxy.javassist.CtMethod

            }
            else {
                Declarator r = md.getReturn();
                CtClass rtype = gen.resolver.lookupClass(r);
                recordReturnType(rtype, false);
                CtMethod method = new CtMethod(rtype, r.getVariable().get(),
                                           plist, gen.getThisClass());
                method.setModifiers(mod);
                gen.setThisMethod(method);
                md.accept(gen);
                if (md.getBody() != null)
                    method.getMethodInfo().setCodeAttribute(
                                        bytecode.toCodeAttribute());
                else
                    method.setModifiers(mod | Modifier.ABSTRACT);

                method.setExceptionTypes(tlist);
                return method;
            }
        }
        catch (NotFoundException e) {
            throw new CompileError(e.toString());
View Full Code Here

Examples of org.zeroturnaround.bundled.javassist.CtMethod

  @SuppressWarnings("unchecked")
  public void process(ClassPool classpool, ClassLoader classloader, CtClass ctClass) throws Exception {
    if (IDEPATCH_CLASS.equals(ctClass.getName())) {
      Collection<String> classes = ctClass.getRefClasses();
      if (!classes.contains(IDESUPPORT_CLASS)) {
        CtMethod m = ctClass.getMethod(IDEPATCH_METHODNAME, IDEPATCH_SIGNATURE);
        m.insertBefore(IDEPATCH_CODE);
      }
    }
    if (WORKERTHREAD_CLASS.equals(ctClass.getName())) {
      CtMethod m = ctClass.getMethod(WORKERPATCH_METHODNAME, WORKERPATCH_SIGNATURE);
      m.insertBefore(WORKERPATCH_CODE);
    }
  }
View Full Code Here

Examples of spoon.reflect.declaration.CtMethod

      invocationData.receive = recv;
    } else {
      if (invocation.getExecutable() != null &&
          invocation.getExecutable().getDeclaration() != null &&
          invocation.getExecutable().getDeclaration() instanceof CtMethod ){
        CtMethod m = (CtMethod)invocation.getExecutable().getDeclaration();
        ReplyActivity replyAnn = m.getAnnotation(ReplyActivity.class);
        if (replyAnn != null && invocation.getArguments().size() == 1){
          scan(invocation.getArguments().get(0));
          ASTNodeData arg = nodeDataStack.peek();
          if (arg.xsdType != null && arg.xpathExpr != null && arg.variable != null){
            for (Receive recv : methodReceiveMap.values()){
              if (recv.getName().equals(replyAnn.receiveName())){
                Reply reply = BPELFactory.eINSTANCE.createReply();
                String replyName = m.getSimpleName();
                if (!replyAnn.name().equals(""))
                  replyName = replyAnn.name();
                reply.setName(replyName);
                if (exceptionTypes.contains(invocation.getArguments().get(0).getType().getDeclaration()))
                  reply.setFaultName(arg.xsdTypeQName);
                BpelScope tmpScope = new BpelScopeImpl();
                setReplyParameters(recv, reply, arg.variable, arg.xsdType, arg.xpathExpr, tmpScope);
                invocationData.activity = tmpScope.getActivity();
                invocationData.replyActivity = reply;
                invocationData.reply = reply;
                if (m.getAnnotation(FlowActivity.class) != null){
                  createMethodFlowMapping(m, invocationData.activity);
                  invocationData.flowActivity = invocationData.activity;
                  invocationData.flowMethod = m;
                }
                break;
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.