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;
}
java类com.google.gson.internal.JsonReaderInternalAccess的实例源码
MapTypeAdapterFactory.java 文件源码
项目:letv
阅读 39
收藏 0
点赞 0
评论 0
MapTypeAdapterFactory.java 文件源码
项目:boohee_v5.6
阅读 30
收藏 0
点赞 0
评论 0
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;
}
f.java 文件源码
项目:MiBandDecompiled
阅读 34
收藏 0
点赞 0
评论 0
public Map a(JsonReader jsonreader)
{
JsonToken jsontoken = jsonreader.peek();
if (jsontoken == JsonToken.NULL)
{
jsonreader.nextNull();
return null;
}
Map map = (Map)d.construct();
if (jsontoken == JsonToken.BEGIN_ARRAY)
{
jsonreader.beginArray();
for (; jsonreader.hasNext(); jsonreader.endArray())
{
jsonreader.beginArray();
Object obj1 = b.read(jsonreader);
if (map.put(obj1, c.read(jsonreader)) != null)
{
throw new JsonSyntaxException((new StringBuilder()).append("duplicate key: ").append(obj1).toString());
}
}
jsonreader.endArray();
return map;
}
jsonreader.beginObject();
while (jsonreader.hasNext())
{
JsonReaderInternalAccess.INSTANCE.promoteNameToValue(jsonreader);
Object obj = b.read(jsonreader);
if (map.put(obj, c.read(jsonreader)) != null)
{
throw new JsonSyntaxException((new StringBuilder()).append("duplicate key: ").append(obj).toString());
}
}
jsonreader.endObject();
return map;
}