[FEATURE] 自定义反序列化/序列化的时候, 可以通过@JSONField传递参数到ObjectReader的readObject方法?
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
### 请描述您的需求或者改进建议
*对您想要需求或建议的清晰简洁的描述。*
在使用注解 进行 序列化和反序列化的时候,
@JSONField(deserializeUsing = MyObjectReader.class)
能不能从注解这里, 直接带参数到ObjectReader类的readObject方法,
### 请描述你建议的实现方案
*对您想要需求或建议的实现方案的详细描述。*
注解
`
@JSONField(deserializeUsing = MyObjectReader.class, xx="人民币")
private String money1;
@JSONField(deserializeUsing = MyObjectReader.class, xx="美元")
private String money2;`
`public class MyObjectReader implements ObjectReader {
@Override
public String readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) {
return jsonReader.readString()+xx;
}
}`
### 描述您考虑过的替代方案
*对您考虑过的任何替代解决方案或功能的描述。*
或者可以通过 注解上的deserializeFeatures参数的 Features做到这种功能?
#### 附加信息
*如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。*
Contributor guide
Research direction
Start by tracing the @JSONField deserializeUsing annotation to the ObjectReader.readObject entry point. Determine how an annotation value could reach a custom reader for the money1 and money2 examples; done means each field can pass its own parameter during deserialization, with the supported behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100