Skip to content

Commit

Permalink
Complete 3.0 conversion of jackson-module-android-record
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Nov 10, 2023
1 parent 750e0c1 commit d3b6f9a
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.fasterxml.jackson.annotation.JacksonInject;

import tools.jackson.databind.*;
import tools.jackson.databind.cfg.MapperBuilder;
import tools.jackson.databind.cfg.MapperConfig;
import tools.jackson.databind.deser.CreatorProperty;
import tools.jackson.databind.deser.SettableBeanProperty;
Expand Down Expand Up @@ -86,7 +87,11 @@ public String findNameForRegularGetter(AnnotatedMethod am, String name)
static class AndroidRecordClassIntrospector extends BasicClassIntrospector {
private static final long serialVersionUID = 1L;

public AndroidRecordClassIntrospector(DeserializationConfig config) {
public AndroidRecordClassIntrospector() {
super();
}

AndroidRecordClassIntrospector(MapperConfig<?> config) {
super(config);
}

Expand All @@ -100,13 +105,24 @@ protected POJOPropertiesCollector collectProperties(JavaType type, AnnotatedClas
}
return super.collectProperties(type, classDef, forSerialization, mutatorPrefix);
}

@Override
public BasicClassIntrospector forMapper() {
return this;
}

@Override
public BasicClassIntrospector forOperation(MapperConfig<?> config) {
return new AndroidRecordClassIntrospector(config);
}
}

@Override
public void setupModule(SetupContext context) {
super.setupModule(context);
MapperBuilder<?,?> builder = (MapperBuilder<?,?>) context.getOwner();
context.addValueInstantiators(new AndroidValueInstantiators());
context.setClassIntrospector(new AndroidRecordClassIntrospector());
builder.classIntrospector(new AndroidRecordClassIntrospector());
}

static boolean isDesugaredRecordClass(Class<?> raw) {
Expand Down

0 comments on commit d3b6f9a

Please sign in to comment.