Skip to content

Commit

Permalink
Merge pull request #20784 from netodevel/feature/netodevel-jackson-wi…
Browse files Browse the repository at this point in the history
…th-records

Adds processor to annotation JsonAutoDetect
  • Loading branch information
geoand authored Oct 15, 2021
2 parents fc33bb3 + 6a58ff9 commit aece5fe
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jboss.jandex.IndexView;
import org.jboss.jandex.Type;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.SimpleObjectIdResolver;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
Expand Down Expand Up @@ -55,6 +56,8 @@ public class JacksonProcessor {

private static final DotName JSON_SERIALIZE = DotName.createSimple(JsonSerialize.class.getName());

private static final DotName JSON_AUTO_DETECT = DotName.createSimple(JsonAutoDetect.class.getName());

private static final DotName JSON_CREATOR = DotName.createSimple("com.fasterxml.jackson.annotation.JsonCreator");

private static final DotName JSON_NAMING = DotName.createSimple("com.fasterxml.jackson.databind.annotation.JsonNaming");
Expand Down Expand Up @@ -168,6 +171,14 @@ void register(
}
}

for (AnnotationInstance creatorInstance : index.getAnnotations(JSON_AUTO_DETECT)) {
if (creatorInstance.target().kind().equals(CLASS)) {
reflectiveClass
.produce(
new ReflectiveClassBuildItem(true, true, creatorInstance.target().asClass().name().toString()));
}
}

// make sure we register the constructors and methods marked with @JsonCreator for reflection
for (AnnotationInstance creatorInstance : index.getAnnotations(JSON_CREATOR)) {
if (METHOD == creatorInstance.target().kind()) {
Expand Down

0 comments on commit aece5fe

Please sign in to comment.