Hi,
First of all, thank you for this wonderful library!
Unfortunately, we are facing an issue with a Generic model. I've modified one of the library test to match the use case:
@JsonObject
public class SimpleGenericModel<T> {
@JsonField
public String string;
@JsonField
public Date date;
@JsonField(name = "test_int")
public int testInt;
@JsonField(name = "test_long")
public long testLong;
@JsonField(name = "test_float")
public float testFloat;
@JsonField(name = "test_double")
public double testDouble;
@JsonField(name = "test_string")
public String testString;
@JsonField(name = "test_int_obj")
public Integer testIntObj;
@JsonField(name = "test_long_obj")
public Long testLongObj;
@JsonField(name = "test_float_obj")
public Float testFloatObj;
@JsonField(name = "test_double_obj")
public Double testDoubleObj;
@JsonField(name = "test_t")
public T testT;
@JsonField(name = "test_nested_generic")
public SimpleGenericModel<String> testNestedGeneric;
}
@JsonObject
public class AnotherClass {
@JsonField
public int value;
@JsonField
public String name;
}
Class com.bluelinelabs.logansquare.processor.model.SimpleGenericModel could not be mapped to a JSON object. Perhaps it hasn't been annotated with @JsonObject?
Is it a supported use case?
Please find below a link to the patch I used to highlight my issue:
Hi, First of all, thank you for this wonderful library! Unfortunately, we are facing an issue with a Generic model. I've modified one of the library test to match the use case:
The json looks like this:
Finally, I'm parsing this data using:
This code give me a:
Class com.bluelinelabs.logansquare.processor.model.SimpleGenericModel could not be mapped to a JSON object. Perhaps it hasn't been annotated with @JsonObject?
Is it a supported use case?
Please find below a link to the patch I used to highlight my issue:
https://github.com/NicoEkino/LoganSquare/commit/e2277e0003dd863b6135fc4eba9b8085dfcaf0eb
Best regards, Nicolas