Package javassist

Examples of javassist.CtClass.addConstructor()


      {
         CtConstructor conTemplate = superInvocation.getDeclaredConstructors()[i];
         CtConstructor icon = CtNewConstructor.make(conTemplate.getParameterTypes(),
                  conTemplate.getExceptionTypes(),
                  invocation);
         invocation.addConstructor(icon);
      }
  
      return invocation;
   }
  
View Full Code Here


      }
      if (template == null)
         throw new IllegalStateException("Could not find template");
      CtConstructor icon = CtNewConstructor.make(template.getParameterTypes(),
            template.getExceptionTypes(), invocation);
      invocation.addConstructor(icon);
  
      ////////////////
      //Add typed fields
      addArgumentFieldsAndAccessors(pool, invocation, con.getParameterTypes(), false);
     
View Full Code Here

            clazz, className, conInvocation);
     
      CtConstructor template = conInvocation.getDeclaredConstructors()[0];
      CtConstructor icon = CtNewConstructor.make(template.getParameterTypes(),
            template.getExceptionTypes(), invocation);
      invocation.addConstructor(icon);

      ////////////////
      //Add typed fields
      CtClass[] params = con.getParameterTypes();
      addArgumentFieldsAndAccessors(pool, invocation, params, false);
View Full Code Here

            break;
         }
      }
      CtConstructor icon = CtNewConstructor.make(template.getParameterTypes(),
            template.getExceptionTypes(), invocation);
      invocation.addConstructor(icon);
  
      ////////////////
      //Add typed fields
      addArgumentFieldsAndAccessors(pool, invocation, con.getParameterTypes(), false);
     
View Full Code Here

            clazz, className, conInvocation);
     
      CtConstructor template = conInvocation.getDeclaredConstructors()[0];
      CtConstructor icon = CtNewConstructor.make(template.getParameterTypes(),
            template.getExceptionTypes(), invocation);
      invocation.addConstructor(icon);

      ////////////////
      //Add typed fields
      CtClass[] params = con.getParameterTypes();
      addArgumentFieldsAndAccessors(pool, invocation, params, false);
View Full Code Here

        String[] methods = METHODS_PATTERN.split(body);
        for (String method : methods) {
          method = method.trim();
          if (method.length() > 0) {
            if (method.startsWith(className)) {
              cls.addConstructor(CtNewConstructor.make("public " + method, cls));
            } else if (method.indexOf('{') < 0 || FIELD_PATTERN.matcher(method).matches()) {
              cls.addField(CtField.make("private " + method, cls));
            } else {
              cls.addMethod(CtNewMethod.make("public " + method, cls));
            }
View Full Code Here

        field.setModifiers(syntheticModifier);
        javassistClass.addField(field);
        CtConstructor ctor = new CtConstructor(new CtClass[]{CtClass.intType}, javassistClass);
        ctor.setModifiers(syntheticModifier);
        ctor.setBody("{super();}");
        javassistClass.addConstructor(ctor);

        long javassistSerialVerUid = JavassistHelper.calculateSerialVerUid(javassistClass);

        Class javaClassGenerated = javassistClass.toClass();
        long javaSerialVerUid = ObjectStreamClass.lookup(javaClassGenerated).getSerialVersionUID();
View Full Code Here

            } catch (ClassNotFoundException e) {
                ClassPool pool = ClassGenerator.getClassPool(clazz.getClassLoader());
                CtClass ctClass = pool.makeClass(parameterClassName);
                ClassFile classFile = ctClass.getClassFile();
                classFile.setVersionToJava5();
                ctClass.addConstructor(CtNewConstructor.defaultConstructor(pool.getCtClass(parameterClassName)));
                // parameter fields
                Class<?>[] parameterTypes = method.getParameterTypes();
                Annotation[][] parameterAnnotations = method.getParameterAnnotations();
                for (int i = 0; i < parameterTypes.length; i ++) {
                    Class<?> type = parameterTypes[i];
View Full Code Here

      }*/
      result.addInterface(pool.get(JavassistMethod.class.getName()));
     
      CtConstructor constructor = new CtConstructor(null, result);
      constructor.setBody("super();");
      result.addConstructor(constructor);
     
      CtClass object = pool.get(Object.class.getName());
     
      JBossStringBuilder buffer = new JBossStringBuilder();
     
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.