Add records support
This commit is contained in:
parent
3aaa787198
commit
424c3f1c45
5
pom.xml
5
pom.xml
@ -86,6 +86,11 @@
|
||||
<artifactId>moshi</artifactId>
|
||||
<version>1.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.zacsweers.moshix</groupId>
|
||||
<artifactId>moshi-records-reflect</artifactId>
|
||||
<version>0.11.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ import com.squareup.moshi.JsonReader;
|
||||
import com.squareup.moshi.JsonReader.Options;
|
||||
import com.squareup.moshi.JsonWriter;
|
||||
import com.squareup.moshi.Moshi;
|
||||
import dev.zacsweers.moshix.records.RecordsJsonAdapterFactory;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -43,7 +44,7 @@ public abstract class MoshiPolymorphic<OBJ> {
|
||||
private synchronized void initialize() {
|
||||
if (!this.initialized) {
|
||||
this.initialized = true;
|
||||
var abstractMoshiBuilder = new Moshi.Builder();
|
||||
var abstractMoshiBuilder = new Moshi.Builder().add(new RecordsJsonAdapterFactory());
|
||||
var abstractClasses = getAbstractClasses();
|
||||
var concreteClasses = getConcreteClasses();
|
||||
var extraAdapters = getExtraAdapters();
|
||||
|
Loading…
x
Reference in New Issue
Block a user