diff --git a/vertx-codegen-processor/src/main/java/io/vertx/codegen/type/DataObjectInfo.java b/vertx-codegen-processor/src/main/java/io/vertx/codegen/type/DataObjectInfo.java index 4172b3794..25d837e3a 100644 --- a/vertx-codegen-processor/src/main/java/io/vertx/codegen/type/DataObjectInfo.java +++ b/vertx-codegen-processor/src/main/java/io/vertx/codegen/type/DataObjectInfo.java @@ -25,7 +25,13 @@ public boolean isAnnotated() { } public TypeInfo getJsonType() { - return deserializer != null ? deserializer.getJsonType() : serializer.getJsonType(); + if (deserializer != null) { + return deserializer.getJsonType(); + } else if (serializer != null) { + return serializer.getJsonType(); + } else { + return null; + } } public MapperInfo getSerializer() { diff --git a/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/DataObjectTest.java b/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/DataObjectTest.java index a5421a8e4..6ae37313f 100644 --- a/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/DataObjectTest.java +++ b/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/DataObjectTest.java @@ -8,6 +8,7 @@ import io.vertx.codegen.annotations.VertxGen; import io.vertx.codegen.doc.Doc; import io.vertx.codegen.type.*; +import io.vertx.core.buffer.Buffer; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import io.vertx.test.codegen.annotations.EmptyAnnotation; @@ -951,4 +952,18 @@ private void assertInvalidDataObject(Class dataObjectClass) throws Exception } catch (GenException ignore) { } } + + @Test + public void testBuffer() throws Exception { + DataObjectModel model = new GeneratorHelper() + .generateDataObject(BufferHolder.class); + assertNotNull(model); + assertTrue(model.isClass()); + + PropertyInfo prop = model.getPropertyMap().get("buffer"); + assertNotNull(prop); + assertFalse(prop.getType().getDataObject().isDeserializable()); + assertFalse(prop.getType().getDataObject().isSerializable()); + assertNull(prop.getType().getDataObject().getJsonType()); + } } diff --git a/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/testdataobject/BufferHolder.java b/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/testdataobject/BufferHolder.java new file mode 100644 index 000000000..c8a47641b --- /dev/null +++ b/vertx-codegen-processor/src/test/java/io/vertx/test/codegen/testdataobject/BufferHolder.java @@ -0,0 +1,18 @@ +package io.vertx.test.codegen.testdataobject; + +import io.vertx.codegen.annotations.DataObject; +import io.vertx.core.buffer.Buffer; + +@DataObject +public class BufferHolder { + + private Buffer buffer; + + public Buffer getBuffer() { + return buffer; + } + + public void setBuffer(Buffer buffer) { + this.buffer = buffer; + } +}