From 0c5f5f46f777c8dd63959466b2cd6e49f82a915a Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Thu, 10 Oct 2024 14:24:05 +0200 Subject: [PATCH] Since buffer is now a data object we need to handle it differently when generating templates --- .../sqlclient/templates/generator/RowMapperGen.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vertx-sql-client-templates/src/main/java/io/vertx/sqlclient/templates/generator/RowMapperGen.java b/vertx-sql-client-templates/src/main/java/io/vertx/sqlclient/templates/generator/RowMapperGen.java index 851fce3fa..058f1dafa 100644 --- a/vertx-sql-client-templates/src/main/java/io/vertx/sqlclient/templates/generator/RowMapperGen.java +++ b/vertx-sql-client-templates/src/main/java/io/vertx/sqlclient/templates/generator/RowMapperGen.java @@ -11,6 +11,7 @@ import io.vertx.codegen.processor.type.MapperInfo; import io.vertx.codegen.processor.type.PrimitiveTypeInfo; import io.vertx.codegen.processor.type.TypeInfo; +import io.vertx.core.buffer.Buffer; import io.vertx.sqlclient.templates.RowMapper; import io.vertx.sqlclient.templates.annotations.Column; import io.vertx.sqlclient.templates.annotations.RowMapped; @@ -148,7 +149,7 @@ private void bilto4(PrintWriter writer, Function getter, Propert private static String wrapExpr(TypeInfo type, String expr) { DataObjectInfo dataObject = type.getDataObject(); - if (dataObject != null) { + if (dataObject != null && !type.getName().equals(Buffer.class.getName())) { MapperInfo deserializer = dataObject.getDeserializer(); if (deserializer != null) { if (deserializer.getKind() == MapperKind.SELF) { @@ -164,7 +165,7 @@ private static String wrapExpr(TypeInfo type, String expr) { private static String rowType(TypeInfo type) { DataObjectInfo dataObject = type.getDataObject(); - if (dataObject != null) { + if (dataObject != null && !type.getName().equals(Buffer.class.getName())) { TypeInfo dataObjectType = dataObject.getJsonType(); if (dataObjectType != null) { return dataObjectType.getName(); @@ -214,10 +215,6 @@ private static String getter(TypeInfo type) { return "getJsonArray"; } if (type instanceof ClassTypeInfo) { - DataObjectInfo dataObject = type.getDataObject(); - if (dataObject != null && dataObject.isSerializable()) { - return getter(dataObject.getSerializer().getJsonType()); - } ClassTypeInfo ct = (ClassTypeInfo) type; switch (ct.getName()) { case "java.time.LocalDateTime": @@ -238,6 +235,10 @@ private static String getter(TypeInfo type) { return "getBuffer"; } } + DataObjectInfo dataObject = type.getDataObject(); + if (dataObject != null && dataObject.isSerializable()) { + return getter(dataObject.getSerializer().getJsonType()); + } return null; } }