bluelinelabs / bluelinelabs/LoganSquare

Genric type list support to map to child type JSON mapping

Open
#89 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
3.2k
Forks
303
PR merge metrics
No merged PRs in 30d

Description

I could not figure out if TypeConverter could support such a use case and hence I am raising an issue. Consider the following situation:

```
@JsonObject
class A{
@JsonField
String aa;
}
@JsonObject
class B extends A{
@JsonField
String bb;

}
@JsonObject
class C extends A{
@JsonField
String cc;
}
```

I want to parse my incoming JSON array into `List` but while fetching them I would like to type cast them as the child classes of `B` and `C` and use `cInstance.getCc()` .Is this possible?

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file, test, or entry point is named; begin by tracing TypeConverter and the existing @JsonObject/@JsonField mapping path. A complete change would need an agreed mechanism for selecting B or C while reading List, plus tests showing both child mappings and access to their fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.