for (Iterator<JProperty> iter = properties.iterator(); iter.hasNext();) {
JProperty property = iter.next();
String propname = toPropertyCase(property.getSimpleName());
boolean cached = isCachedProperty(property);
JAnnotation annotation = property.getGetter().getAnnotation("openwire:property");
JAnnotationValue size = annotation.getValue("size");
type = property.getType().getQualifiedName();
if (type.equals("boolean")) {
out.println(" ow_bit_buffer_append(buffer, object->" + propname + ");");
} else if (type.equals("byte")) {
} else if (type.equals("char")) {
} else if (type.equals("short")) {
} else if (type.equals("int")) {
} else if (type.equals("long")) {
out.println(" ow_marshal1_long(buffer, object->" + propname + ");");
} else if (type.equals("byte[]")) {
if (size == null) {
out.println(" ow_bit_buffer_append(buffer, object->" + propname + "!=0 );");
}
} else if (type.equals("org.apache.activeio.packet.ByteSequence")) {
if (size == null) {
out.println(" ow_bit_buffer_append(buffer, object->" + propname + "!=0 );");
}
} else if (type.equals("java.lang.String")) {
out.println(" ow_marshal1_string(buffer, object->" + propname + ");");
} else {
if (property.getType().isArrayType()) {
if (size != null) {
out.println(" SUCCESS_CHECK(ow_marshal1_DataStructure_array_const_size(buffer, object->" + propname + ", " + size.asInt() + "));");
} else {
out.println(" SUCCESS_CHECK(ow_marshal1_DataStructure_array(buffer, object->" + propname + "));");
}
} else if (isThrowable(property.getType())) {
out.println(" SUCCESS_CHECK(ow_marshal1_throwable(buffer, object->" + propname + "));");
} else {
if (cached) {
out.println(" SUCCESS_CHECK(ow_marshal1_cached_object(buffer, (ow_DataStructure*)object->" + propname + "));");
} else {
out.println(" SUCCESS_CHECK(ow_marshal1_nested_object(buffer, (ow_DataStructure*)object->" + propname + "));");
}
}
}
out.println("");
}
out.println(" ");
out.println(" return APR_SUCCESS;");
out.println("}");
out.println("apr_status_t ow_marshal2_" + name + "(ow_byte_buffer *buffer, ow_bit_buffer *bitbuffer, ow_" + name + " *object)");
out.println("{");
out.println(" ow_marshal2_" + baseName + "(buffer, bitbuffer, (ow_" + baseName + "*)object); ");
for (Iterator<JProperty> iter = properties.iterator(); iter.hasNext();) {
JProperty property = iter.next();
JAnnotation annotation = property.getGetter().getAnnotation("openwire:property");
JAnnotationValue size = annotation.getValue("size");
Object propname = toPropertyCase(property.getSimpleName());
boolean cached = isCachedProperty(property);
type = property.getType().getQualifiedName();
if (type.equals("boolean")) {
out.println(" ow_bit_buffer_read(bitbuffer);");
} else if (type.equals("byte")) {
out.println(" SUCCESS_CHECK(ow_byte_buffer_append_" + type + "(buffer, object->" + propname + "));");
} else if (type.equals("char")) {
out.println(" SUCCESS_CHECK(ow_byte_buffer_append_" + type + "(buffer, object->" + propname + "));");
} else if (type.equals("short")) {
out.println(" SUCCESS_CHECK(ow_byte_buffer_append_" + type + "(buffer, object->" + propname + "));");
} else if (type.equals("int")) {
out.println(" SUCCESS_CHECK(ow_byte_buffer_append_" + type + "(buffer, object->" + propname + "));");
} else if (type.equals("long")) {
out.println(" SUCCESS_CHECK(ow_marshal2_long(buffer, bitbuffer, object->" + propname + "));");
} else if (type.equals("byte[]")) {
if (size != null) {
out.println(" SUCCESS_CHECK(ow_marshal2_byte_array_const_size(buffer, object->" + propname + ", " + size.asInt() + "));");
} else {
out.println(" SUCCESS_CHECK(ow_marshal2_byte_array(buffer, bitbuffer, object->" + propname + "));");
}
} else if (type.equals("org.apache.activeio.packet.ByteSequence")) {
if (size != null) {
out.println(" SUCCESS_CHECK(ow_marshal2_byte_array_const_size(buffer, object->" + propname + ", " + size.asInt() + "));");
} else {
out.println(" SUCCESS_CHECK(ow_marshal2_byte_array(buffer, bitbuffer, object->" + propname + "));");
}
} else if (type.equals("java.lang.String")) {
out.println(" SUCCESS_CHECK(ow_marshal2_string(buffer, bitbuffer, object->" + propname + "));");
} else {
if (property.getType().isArrayType()) {
if (size != null) {
out.println(" SUCCESS_CHECK(ow_marshal2_DataStructure_array_const_size(buffer, bitbuffer, object->" + propname + ", " + size.asInt() + "));");
} else {
out.println(" SUCCESS_CHECK(ow_marshal2_DataStructure_array(buffer, bitbuffer, object->" + propname + "));");
}
} else if (isThrowable(property.getType())) {
out.println(" SUCCESS_CHECK(ow_marshal2_throwable(buffer, bitbuffer, object->" + propname + "));");
} else {
if (cached) {
out.println(" SUCCESS_CHECK(ow_marshal2_cached_object(buffer, bitbuffer, (ow_DataStructure*)object->" + propname + "));");
} else {
out.println(" SUCCESS_CHECK(ow_marshal2_nested_object(buffer, bitbuffer, (ow_DataStructure*)object->" + propname + "));");
}
}
}
out.println("");
}
out.println(" ");
out.println(" return APR_SUCCESS;");
out.println("}");
out.println("");
out.println("apr_status_t ow_unmarshal_" + name + "(ow_byte_array *buffer, ow_bit_buffer *bitbuffer, ow_" + name + " *object, apr_pool_t *pool)");
out.println("{");
out.println(" ow_unmarshal_" + baseName + "(buffer, bitbuffer, (ow_" + baseName + "*)object, pool); ");
for (Iterator<JProperty> iter = properties.iterator(); iter.hasNext();) {
JProperty property = iter.next();
JAnnotation annotation = property.getGetter().getAnnotation("openwire:property");
JAnnotationValue size = annotation.getValue("size");
String propname = toPropertyCase(property.getSimpleName());
boolean cached = isCachedProperty(property);
type = property.getType().getQualifiedName();