protected void generateMarshal2Body(PrintWriter out) {
List properties = getProperties();
for (Iterator iter = properties.iterator(); iter.hasNext();) {
JProperty property = (JProperty)iter.next();
JAnnotation annotation = property.getAnnotation("openwire:property");
JAnnotationValue size = annotation.getValue("size");
JClass propertyType = property.getType();
String type = propertyType.getSimpleName();
String getter = "info." + property.getGetter().getSimpleName() + "()";
out.print(indent);
if (type.equals("boolean")) {
out.println("bs.readBoolean();");
} else if (type.equals("byte")) {
out.println("DataStreamMarshaller.writeByte(" + getter + ", dataOut);");
} else if (type.equals("char")) {
out.println("DataStreamMarshaller.writeChar(" + getter + ", dataOut);");
} else if (type.equals("short")) {
out.println("DataStreamMarshaller.writeShort(" + getter + ", dataOut);");
} else if (type.equals("int")) {
out.println("DataStreamMarshaller.writeInt(" + getter + ", dataOut);");
} else if (type.equals("long")) {
out.println("marshal2Long(wireFormat, " + getter + ", dataOut, bs);");
} else if (type.equals("String")) {
out.println("writeString(" + getter + ", dataOut, bs);");
} else if (type.equals("byte[]") || type.equals("ByteSequence")) {
if (size != null) {
out.println("dataOut.write(" + getter + ", 0, " + size.asInt() + ");");
} else {
out.println("if(bs.readBoolean()) {");
out.println(" DataStreamMarshaller.writeInt(" + getter + ".Length, dataOut);");
out.println(" dataOut.write(" + getter + ");");
out.println(" }");
}
} else if (propertyType.isArrayType()) {
if (size != null) {
out.println("marshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, bs, " + size.asInt() + ");");
} else {
out.println("marshalObjectArray(wireFormat, " + getter + ", dataOut, bs);");
}
} else if (isThrowable(propertyType)) {
out.println("marshalBrokerError(wireFormat, " + getter + ", dataOut, bs);");