Skip to content

Commit

Permalink
Since buffer is now a data object we need to handle it differently wh…
Browse files Browse the repository at this point in the history
…en generating templates
  • Loading branch information
vietj committed Oct 10, 2024
1 parent e35d5a1 commit 0c5f5f4
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -148,7 +149,7 @@ private void bilto4(PrintWriter writer, Function<String, String> 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) {
Expand All @@ -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();
Expand Down Expand Up @@ -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":
Expand All @@ -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;
}
}

0 comments on commit 0c5f5f4

Please sign in to comment.