-
Notifications
You must be signed in to change notification settings - Fork 572
fix: add setter for FastjsonConfig.writer/readerContext, for issue #4000 #4008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -268,7 +268,7 @@ public void clearContext() { | |
| writerContext = null; | ||
| } | ||
|
|
||
| public JSONReader.Context readerContext() { | ||
| public JSONReader.Context getReaderContext() { | ||
| JSONReader.Context context = readerContext; | ||
| if (context == null) { // Concurrency may occur, but it will not cause any problems | ||
| context = new JSONReader.Context(JSONFactory.getDefaultObjectReaderProvider(), jsonb ? symbolTable : null, readerFilters, readerFeatures); | ||
|
|
@@ -278,7 +278,7 @@ public JSONReader.Context readerContext() { | |
| return context; | ||
| } | ||
|
|
||
| public JSONWriter.Context writerContext() { | ||
| public JSONWriter.Context getWriterContext() { | ||
|
jujn marked this conversation as resolved.
|
||
| JSONWriter.Context context = writerContext; | ||
| if (context == null) { | ||
| context = new JSONWriter.Context(dateFormat, writerFeatures); | ||
|
|
@@ -293,4 +293,32 @@ public JSONWriter.Context writerContext() { | |
| } | ||
| return context; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the JSONReader context. | ||
| * @deprecated Use {@link #getReaderContext()} instead to comply with JavaBean naming conventions. | ||
| * @return the JSONReader context | ||
| */ | ||
| @Deprecated | ||
| public JSONReader.Context readerContext() { | ||
| return getReaderContext(); | ||
| } | ||
|
|
||
| /** | ||
| * Gets the JSONWriter context. | ||
| * @deprecated Use {@link #getWriterContext()} instead to comply with JavaBean naming conventions. | ||
| * @return the JSONWriter context | ||
| */ | ||
| @Deprecated | ||
| public JSONWriter.Context writerContext() { | ||
| return getWriterContext(); | ||
| } | ||
|
|
||
| public void setReaderContext(JSONReader.Context context) { | ||
| this.readerContext = context; | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] 新增的
/**
* Sets a pre-built JSONReader.Context.
* <p><b>Warning:</b> subsequent calls to {@link #setReaderFeatures},
* {@link #setDateFormat}, etc. will invalidate this custom context.
*/
public void setReaderContext(JSONReader.Context context) {
this.readerContext = context;
}— qwen3.7-max via Qwen Code /review |
||
| public void setWriterContext(JSONWriter.Context context) { | ||
| this.writerContext = context; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.