File tree Expand file tree Collapse file tree 2 files changed +0
-53
lines changed
charts/src/main/java/com/github/aachartmodel/aainfographics Expand file tree Collapse file tree 2 files changed +0
-53
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,6 @@ import com.github.aachartmodel.aainfographics.aaoptionsmodel.AAPointEvents
5151import com.github.aachartmodel.aainfographics.aaoptionsmodel.AASeries
5252import com.github.aachartmodel.aainfographics.aatools.AAColor
5353import com.github.aachartmodel.aainfographics.aatools.AAJSStringPurer
54- // import com.github.aachartmodel.aainfographics.aatools.AANull
55- // import com.github.aachartmodel.aainfographics.aatools.AANullAdapter
56- // import com.github.aachartmodel.aainfographics.aatools.AANullObjectAdapter
5754import com.github.aachartmodel.aainfographics.aatools.aa_toJSArray
5855import com.google.gson.Gson
5956import com.google.gson.GsonBuilder
@@ -130,12 +127,8 @@ class AAChartView : WebView {
130127
131128 private var optionsJson: String? = null
132129
133- // Centralized Gson configured to handle AANull and keep null fields
134130 private val aaGson: Gson by lazy {
135131 GsonBuilder ()
136- // .registerTypeAdapter(String::class.java, AANullAdapter())
137- // .registerTypeAdapter(AANull::class.java, AANullObjectAdapter())
138- // .serializeNulls()
139132 .create()
140133 }
141134
Original file line number Diff line number Diff line change 11package com.github.aachartmodel.aainfographics.aatools
22
3- import com.google.gson.TypeAdapter
4- import com.google.gson.annotations.JsonAdapter
5- import com.google.gson.stream.JsonReader
6- import com.google.gson.stream.JsonToken
7- import com.google.gson.stream.JsonWriter
8-
9- // // 实现 Javascript 中的 null 值的效果
10- // @JsonAdapter(AANullObjectAdapter::class)
113class AANull {
124}
13- //
14- // // Adapter used for String properties: when the literal string "AANull" is encountered, output real JSON null
15- // class AANullAdapter : TypeAdapter<String>() {
16- // override fun write(out: JsonWriter, value: String?) {
17- // if (value == "AANull") {
18- // out.nullValue() // 输出真正的 null
19- // } else {
20- // out.value(value)
21- // }
22- // }
23- //
24- // override fun read(reader: JsonReader): String? {
25- // return if (reader.peek() == JsonToken.NULL) {
26- // reader.nextNull()
27- // null
28- // } else {
29- // val result = reader.nextString()
30- // if (result == "AANull") null else result
31- // }
32- // }
33- // }
34- //
35- // // Adapter used for AANull object properties: serialize any AANull instance as JSON null
36- // class AANullObjectAdapter : TypeAdapter<AANull>() {
37- // override fun write(out: JsonWriter, value: AANull?) {
38- // out.nullValue()
39- // }
40- //
41- // override fun read(reader: JsonReader): AANull? {
42- // if (reader.peek() == JsonToken.NULL) {
43- // reader.nextNull()
44- // } else {
45- // // Consume any unexpected token to keep the stream consistent
46- // reader.skipValue()
47- // }
48- // return null
49- // }
50- // }
You can’t perform that action at this time.
0 commit comments