fix(serialize-generator): Discard annotations in Date/String adapter
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2024-04-20 20:47:10 +02:00
parent 5fad1d053d
commit 5c183a79de
Signed by: Johannes
GPG Key ID: E76429612C2929F4
3 changed files with 6 additions and 4 deletions

View File

@ -44,11 +44,11 @@ public class CollectionAdapter extends Adapter<CollectionAdapter.Hydrated> {
if (typeArguments.size() == 0) {
type = null;
} else {
componentType = typeArguments.get(0);
componentType = typeArguments.getFirst();
String ts = TypeHelper.asDeclaredType(typeUtils.erasure(type)).asElement().toString();
for (Map.Entry<Class<?>, List<Class<?>>> entry : SUPPORTED.entrySet()) {
if (entry.getKey().getCanonicalName().equals(ts)) {
implType = TypeName.get(entry.getValue().get(0));
implType = TypeName.get(entry.getValue().getFirst());
return;
}
for (Class<?> klazz : entry.getValue()) {

View File

@ -2,6 +2,7 @@ package io.gitlab.jfronny.commons.serialize.generator.adapter.impl;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import io.gitlab.jfronny.commons.serialize.generator.Cl;
import io.gitlab.jfronny.commons.serialize.generator.adapter.Adapter;
@ -19,7 +20,7 @@ public class DateAdapter extends Adapter<DateAdapter.Hydrated> {
public class Hydrated extends Adapter<Hydrated>.Hydrated {
@Override
public boolean applies() {
return type.toString().equals(Date.class.getCanonicalName());
return TypeName.get(type).withoutAnnotations().toString().equals(Date.class.getCanonicalName());
}
@Override

View File

@ -1,5 +1,6 @@
package io.gitlab.jfronny.commons.serialize.generator.adapter.impl;
import com.squareup.javapoet.TypeName;
import io.gitlab.jfronny.commons.serialize.generator.adapter.Adapter;
public class StringAdapter extends Adapter<StringAdapter.Hydrated> {
@ -11,7 +12,7 @@ public class StringAdapter extends Adapter<StringAdapter.Hydrated> {
public class Hydrated extends Adapter<Hydrated>.Hydrated {
@Override
public boolean applies() {
return type.toString().equals(String.class.getCanonicalName());
return TypeName.get(type).withoutAnnotations().toString().equals(String.class.getCanonicalName());
}
@Override