Skip to content

fix: add setter for FastjsonConfig.writer/readerContext, for issue #4000#4008

Open
jujn wants to merge 2 commits intoalibaba:mainfrom
jujn:fix_4000
Open

fix: add setter for FastjsonConfig.writer/readerContext, for issue #4000#4008
jujn wants to merge 2 commits intoalibaba:mainfrom
jujn:fix_4000

Conversation

@jujn
Copy link
Collaborator

@jujn jujn commented Mar 5, 2026

What this PR does / why we need it?

允许用户像 1.x 中那样限定自定义序列化器影响范围,如下所示:

        FastJsonConfig config = new FastJsonConfig();
        
        ObjectWriterProvider provider = new ObjectWriterProvider();
        provider.register(Long.class, ObjectWriters.ofToString(Object::toString));
        provider.register(Integer.class, ObjectWriters.ofToString(Object::toString));
        
        config.setWriterContext(JSONFactory.createWriteContext(provider));

Summary of your change

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant