bluelinelabs / bluelinelabs/LoganSquare

Generic classes with type parameters parsing/serializing

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

Description

Aloha!

For a big project of mine my data is stored as such:

```
abstract class A {
T1 first;
T2 second;
...other simple fields...
}

class B{
}
```

Since the scope for the data is so wide there are N number of classes that all depend on A like this. In GSON I use TypeAdapters to include the class name of each subclass in the json so that it can be read back properly, Id like to see something similar in LoganSquare.

I cannot get it to work the way LoganSquare is built at the moment (If its supported at all?) as it always tries to create instances of A directly.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining LoganSquare's generated parsing and serialization handling for abstract and generic classes, then compare it with the issue's A and B example. Check how GSON TypeAdapters provide subclass type information. Done means subclasses can be serialized with their class identity and read back without trying to instantiate A directly.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.