CtClass[] parameterTypes = new CtClass[parameterCount + 2];
parameterTypes[0] = toCtClass(ComponentMethodInvocationInfo.class);
parameterTypes[1] = toCtClass(Component.class);
BodyBuilder builder = new BodyBuilder().begin().addln("super($1,$2);");
for (int i = 0; i < parameterCount; i++)
{
String name = FIELD_NAME + i;
String parameterTypeName = advisedMethod.getParameterTypes()[i];
CtClass parameterType = classSource.toCtClass(parameterTypeName);
CtField field = new CtField(parameterType, name, invocationCtClass);
field.setModifiers(Modifier.PRIVATE);
invocationCtClass.addField(field);
parameterTypes[2 + i] = parameterType;
builder.addln("%s = $%d;", name, 3 + i);
}
builder.end();
CtConstructor constructor = new CtConstructor(parameterTypes, invocationCtClass);
constructor.setBody(builder.toString());
invocationCtClass.addConstructor(constructor);
}