本文整理汇总了Java中com.google.gson.internal.JsonReaderInternalAccess类的典型用法代码示例。如果您正苦于以下问题:Java JsonReaderInternalAccess类的具体用法?Java JsonReaderInternalAccess怎么用?Java JsonReaderInternalAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonReaderInternalAccess类属于com.google.gson.internal包,在下文中一共展示了JsonReaderInternalAccess类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import com.google.gson.internal.JsonReaderInternalAccess; //导入依赖的package包/类
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;
}
示例2: a
import com.google.gson.internal.JsonReaderInternalAccess; //导入依赖的package包/类
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;
}