creates a public constructor . if howto is pass_params , the created constructor calls the super 's constructor with the same signature . the superclass must contain a constructor taking the same set of parameters as the created one . if howto is pass_none , the created constructor calls the super 's default constructor . the superclass must contain a constructor taking no parameters . if howto is pass_array , the created constructor calls the super 's constructor with the given parameters in the form of an array of object . the signature of the super 's constructor must be : constructor object params , < type > cvalue here , cvalue is the constant value specified by cparam . if cparam is null , the signature must be : constructor object params if body is not null , a copy of that method is embedded in the body of the created constructor . the embedded method is executed after the super 's constructor is called and the values of fields are initialized . note that body must not be a constructor but a method . since the embedded method is wrapped in parameter-conversion code as in ctnewmethod.wrapped , the constructor parameters are passed in the form of an array of object . the method specified by body must have the signature shown below : object method object params , < type > cvalue if cparam is null , the signature must be : object method object params although the type of the returned value is object , the value must be always null . example : classpool pool = ... ; ctclass xclass = pool.makeclass `` x '' ; ctmethod method = pool.getmethod `` sample '' , `` m '' ; xclass.setsuperclass pool.get `` y '' ; ctclass argtypes = ctclass.inttype ; constparameter cparam = constparameter.string `` test '' ; ctconstructor c = ctnewconstructor.make argtypes , null , pass_params , method , cparam , xclass ; xclass.addconstructor c ; where the class sample is as follows : public class sample public object m object args , string msg system.out.println msg ; return null ; this program produces the following class : public class x extends y public x int p0 super p0 ; string msg = `` test '' ; object args = new object p0 ; / / begin of copied body system.out.println msg ; object result = null ; / / end concode_field_sep int PASS_ARRAY concode_elem_sep int PASS_PARAMS concode_elem_sep int PASS_NONE concode_field_sep CtConstructor skeleton concode_elem_sep CtConstructor defaultConstructor concode_elem_sep CtConstructor copy
CtConstructor function ( CtClass [ ] arg0 , CtClass [ ] arg1 , int arg2 , CtMethod arg3 , ConstParameter arg4 , CtClass arg5 ) { return CtNewWrappedConstructor . wrapped ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; }