apache / apache/fory

[Java] Add deserialize overloads that take a TypeRef

Open
#3,946 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.5k
Forks
443
Avg merge
5h 59m
Merged PRs (30d)
77

Description

### Feature Request

`ForyJson` has `fromJson` methods that accept a `Class`, but also has overloads that accept a `TypeRef` for cases when the root type is generic.

`Fory` does not have such overloads, so it is not possible to explicitly deserialize into generic root types.

### Is your feature request related to a problem? Please describe

_No response_

### Describe the solution you'd like

It would be great if `Fory.deserialize` added such overloads

### Describe alternatives you've considered

I tried `TypeResolver.getSerializer`, but couldn't figure out where to get the `ReadContext` for the resulting `Serializer` - it seemed like using too low-level tools for a high-level goal.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with Fory.deserialize and compare the existing ForyJson.fromJson overloads that accept TypeRef. Trace how TypeResolver and ReadContext are used, then add the requested overloads and confirm that generic root types can be deserialized through the high-level API.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.