Examples of CtConstructor


Examples of javassist.CtConstructor

            }
         }
                 
         body.append("}");

         CtConstructor ctor = CtNewConstructor.make(paramTypes, superCtor.getExceptionTypes(), body.toString(), clazz);
         ctor.setModifiers(superCtor.getModifiers());
         clazz.addConstructor(ctor);
      }
      catch (CannotCompileException e)
      {
         // AutoGenerated
View Full Code Here

Examples of javassist.CtConstructor

      body.append(");");
      body.append(aspectInitialization);
      body.append(init.toString());
     
      body.append("}");  
      CtConstructor ctor = CtNewConstructor.make(
          params,
          superCtor.getExceptionTypes(),
          body.toString(),
          clazz);
         ctor.setModifiers(superCtor.getModifiers());
         clazz.addConstructor(ctor);
   }
View Full Code Here

Examples of javassist.CtConstructor

         }
         superClass = superClass.getSuperclass();
      }
      body.append("}");
     
      CtConstructor copyCtor = CtNewConstructor.make(new CtClass[] {clazz}, new CtClass[0], body.toString(), clazz);
      copyCtor.setModifiers(Modifier.PRIVATE);
      clazz.addConstructor(copyCtor);
     
      CtMethod superCopy = pool.get(Invocation.class.getName()).getDeclaredMethod("copy");
      String copyBody =
         "{" +
View Full Code Here

Examples of javassist.CtConstructor

        CtBehavior[] cb = thisClass.getDeclaredBehaviors();
        for (int i = cb.length - 1; i >= 0; --i)
            if (cb[i].getMethodInfo2() == mi)
                return cb[i];

        CtConstructor init = thisClass.getClassInitializer();
        if (init != null && init.getMethodInfo2() == mi)
            return init;

        /* getDeclaredBehaviors() returns a list of methods/constructors.
         * Although the list is cached in a CtClass object, it might be
         * recreated for some reason.  Thus, the member name and the signature
View Full Code Here

Examples of javassist.CtConstructor

        CtClass[] tlist = gen.makeThrowsList(md);
        recordParams(plist, Modifier.isStatic(mod));
        md = p.parseMethod2(stable, md);
        try {
            if (md.isConstructor()) {
                CtConstructor cons = new CtConstructor(plist,
                                                   gen.getThisClass());
                cons.setModifiers(mod);
                md.accept(gen);
                cons.getMethodInfo().setCodeAttribute(
                                        bytecode.toCodeAttribute());
                cons.setExceptionTypes(tlist);
                return cons;
            }
            else {
                Declarator r = md.getReturn();
                CtClass rtype = gen.resolver.lookupClass(r);
View Full Code Here

Examples of javassist.CtConstructor

        try
        {
            // And have a public constructor.

            CtConstructor ctor = ctClass.getConstructor("()V");

            if (!Modifier.isPublic(ctor.getModifiers())) return;
        }
        catch (NotFoundException ex)
        {
            return;
        }
View Full Code Here

Examples of javassist.CtConstructor

   protected ConstructorInfo generateConstructorInfo(SignatureKey key)
   {
      CtClass[] params = getParameterTypes(key);
      try
      {
         CtConstructor ctConstructor = ctClass.getDeclaredConstructor(params);
         return generateConstructorInfo(ctConstructor);
      }
      catch (NotFoundException e)
      {
         throw JavassistTypeInfoFactoryImpl.raiseMethodNotFound("for constructor " + getName(), e);
View Full Code Here

Examples of javassist.CtConstructor

     

      final String constructorStr = "super(" + getParamValue(deployment) + "," + siFieldName + "," +
        getParamValue(epInfo.getRequestLocation()) + "," + getParamValue(epInfo.getResponseLocation()) + ", \"" +
        epInfo.getResponseAction() + "\");" ;
      CtConstructor defaultConstructor = new CtConstructor(null, seiClass) ;
      defaultConstructor.setBody(constructorStr) ;
      seiClass.addConstructor(defaultConstructor) ;
     
      return seiClass.toBytecode();
    } catch (Exception e) {
View Full Code Here

Examples of javassist.CtConstructor

        // A constructor resembles a method of type void
        descripton.append(")V");

        try
        {
            CtConstructor ctConstructor = ctClass.getConstructor(descripton.toString());

            int lineNumber = ctConstructor.getMethodInfo().getLineNumber(0);

            String sourceFile = ctConstructor.getDeclaringClass().getClassFile2().getSourceFile();

            builder.append(String.format(" (at %s:%d)", sourceFile, lineNumber));
        }
        catch (Exception ex)
        {
View Full Code Here

Examples of javassist.CtConstructor

        CtClass[] ctParameters = convertClasses(parameterTypes);
        CtClass[] ctExceptions = convertClasses(exceptions);

        try
        {
            CtConstructor constructor = new CtConstructor(ctParameters, getCtClass());
            constructor.setExceptionTypes(ctExceptions);
            constructor.setBody(body);

            getCtClass().addConstructor(constructor);
        }
        catch (Exception ex)
        {
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.