Java 类com.google.gson.internal.LazilyParsedNumber 实例源码

项目:MyTown2    文件:Segment.java   
protected int getRange(Object object) {
    if (!getters.contains("range")) {
        return 0;
    }
    try {
        Object rangeObj = null;
        rangeObj = getters.get("range").invoke(Object.class, object, object);
        if (rangeObj instanceof LazilyParsedNumber) {
            return ((LazilyParsedNumber)rangeObj).intValue();
        } else if (rangeObj instanceof Double) {
            return (int)((Double)rangeObj + 0.5);
        } else if (rangeObj instanceof Integer) {
            return (Integer)rangeObj;
        }
    } catch (GetterException ex) {
    }
    return 0;
}
项目:letv    文件:TypeAdapters.java   
public JsonElement read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NUMBER:
            return new JsonPrimitive(new LazilyParsedNumber(in.nextString()));
        case BOOLEAN:
            return new JsonPrimitive(Boolean.valueOf(in.nextBoolean()));
        case STRING:
            return new JsonPrimitive(in.nextString());
        case NULL:
            in.nextNull();
            return JsonNull.INSTANCE;
        case BEGIN_ARRAY:
            JsonElement array = new JsonArray();
            in.beginArray();
            while (in.hasNext()) {
                array.add(read(in));
            }
            in.endArray();
            return array;
        case BEGIN_OBJECT:
            JsonElement object = new JsonObject();
            in.beginObject();
            while (in.hasNext()) {
                object.add(in.nextName(), read(in));
            }
            in.endObject();
            return object;
        default:
            throw new IllegalArgumentException();
    }
}
项目:letv    文件:TypeAdapters.java   
public Number read(JsonReader in) throws IOException {
    JsonToken jsonToken = in.peek();
    switch (jsonToken) {
        case NUMBER:
            return new LazilyParsedNumber(in.nextString());
        case NULL:
            in.nextNull();
            return null;
        default:
            throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
    }
}
项目:odoo-work    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:odoo-work    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:lams    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:lams    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:boohee_v5.6    文件:TypeAdapters.java   
public JsonElement read(JsonReader in) throws IOException {
    switch (in.peek()) {
        case NUMBER:
            return new JsonPrimitive(new LazilyParsedNumber(in.nextString()));
        case BOOLEAN:
            return new JsonPrimitive(Boolean.valueOf(in.nextBoolean()));
        case STRING:
            return new JsonPrimitive(in.nextString());
        case NULL:
            in.nextNull();
            return JsonNull.INSTANCE;
        case BEGIN_ARRAY:
            JsonElement array = new JsonArray();
            in.beginArray();
            while (in.hasNext()) {
                array.add(read(in));
            }
            in.endArray();
            return array;
        case BEGIN_OBJECT:
            JsonElement object = new JsonObject();
            in.beginObject();
            while (in.hasNext()) {
                object.add(in.nextName(), read(in));
            }
            in.endObject();
            return object;
        default:
            throw new IllegalArgumentException();
    }
}
项目:boohee_v5.6    文件:TypeAdapters.java   
public Number read(JsonReader in) throws IOException {
    JsonToken jsonToken = in.peek();
    switch (jsonToken) {
        case NUMBER:
            return new LazilyParsedNumber(in.nextString());
        case NULL:
            in.nextNull();
            return null;
        default:
            throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
    }
}
项目:odoo-follow-up    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:odoo-follow-up    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:MyJojoXUtils    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:MyJojoXUtils    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:SteamLib    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:SteamLib    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:1797-2017    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
  case STRING:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:1797-2017    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:1797-2017    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
  case STRING:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:1797-2017    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:urmusic-desktop    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:urmusic-desktop    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:external-resources    文件:Resource.java   
@Nullable protected Number getAsNumber() {
  if (isString()) {
    return new LazilyParsedNumber((String) value);
  } else if (isNumber()) {
    return (Number) value;
  } else {
    return null;
  }
}
项目:FMTech    文件:JsonPrimitive.java   
public final Number getAsNumber()
{
  if ((this.value instanceof String)) {
    return new LazilyParsedNumber((String)this.value);
  }
  return (Number)this.value;
}
项目:MiBandDecompiled    文件:JsonPrimitive.java   
public Number getAsNumber()
{
    if (b instanceof String)
    {
        return new LazilyParsedNumber((String)b);
    } else
    {
        return (Number)b;
    }
}
项目:android-http-lib-based-on-volley    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:android-http-lib-based-on-volley    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:reflect-app    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:reflect-app    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:ti.box    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:ti.box    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:androidsummary    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:androidsummary    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:Edge-Node    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:Edge-Node    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:activitystreams    文件:Adapters.java   
private Object des(JsonElement val, JsonDeserializationContext context) {
  if (val.isJsonArray())
    return MultimapAdapter.arraydes(val.getAsJsonArray(), context);
  else if (val.isJsonObject())
    return context.deserialize(val, ASObject.class);
  else if (val.isJsonPrimitive()) {
    Object v = primConverter.convert(val.getAsJsonPrimitive());
    if (v instanceof LazilyParsedNumber) 
      v = new LazilyParsedNumberComparable((LazilyParsedNumber) v);
    return v;
  }
  else
    return null;
}
项目:MyTown2    文件:GetterConstant.java   
@Override
public Object invoke(Class<?> returnType, Object instance, Object... parameters) {
    if (returnType.equals(Integer.class)) {
        return (Object)((LazilyParsedNumber)constant).intValue();
    }
    return constant;
}
项目:BungeeSigns    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:BungeeSigns    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}
项目:multicraft-api    文件:TypeAdapters.java   
@Override
public Number read(JsonReader in) throws IOException {
  JsonToken jsonToken = in.peek();
  switch (jsonToken) {
  case NULL:
    in.nextNull();
    return null;
  case NUMBER:
    return new LazilyParsedNumber(in.nextString());
  default:
    throw new JsonSyntaxException("Expecting number, got: " + jsonToken);
  }
}
项目:multicraft-api    文件:TypeAdapters.java   
@Override public JsonElement read(JsonReader in) throws IOException {
  switch (in.peek()) {
  case STRING:
    return new JsonPrimitive(in.nextString());
  case NUMBER:
    String number = in.nextString();
    return new JsonPrimitive(new LazilyParsedNumber(number));
  case BOOLEAN:
    return new JsonPrimitive(in.nextBoolean());
  case NULL:
    in.nextNull();
    return JsonNull.INSTANCE;
  case BEGIN_ARRAY:
    JsonArray array = new JsonArray();
    in.beginArray();
    while (in.hasNext()) {
      array.add(read(in));
    }
    in.endArray();
    return array;
  case BEGIN_OBJECT:
    JsonObject object = new JsonObject();
    in.beginObject();
    while (in.hasNext()) {
      object.add(in.nextName(), read(in));
    }
    in.endObject();
    return object;
  case END_DOCUMENT:
  case NAME:
  case END_OBJECT:
  case END_ARRAY:
  default:
    throw new IllegalArgumentException();
  }
}