public Map<K, V> read(JsonReader in) throws IOException {
JsonToken peek = in.peek();
if (peek == JsonToken.NULL) {
in.nextNull();
return null;
}
Map<K, V> map = (Map) this.constructor.construct();
K key;
if (peek == JsonToken.BEGIN_ARRAY) {
in.beginArray();
while (in.hasNext()) {
in.beginArray();
key = this.keyTypeAdapter.read(in);
if (map.put(key, this.valueTypeAdapter.read(in)) != null) {
throw new JsonSyntaxException("duplicate key: " + key);
}
in.endArray();
}
in.endArray();
return map;
}
in.beginObject();
while (in.hasNext()) {
JsonReaderInternalAccess.INSTANCE.promoteNameToValue(in);
key = this.keyTypeAdapter.read(in);
if (map.put(key, this.valueTypeAdapter.read(in)) != null) {
throw new JsonSyntaxException("duplicate key: " + key);
}
}
in.endObject();
return map;
}
MapTypeAdapterFactory.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:letv
作者:
评论列表
文章目录