@Override
  public double nextDouble() throws IOException {
    final BsonType type = delegate.getCurrentBsonType();
    switch (type) {
    case DOUBLE:
      return delegate.readDouble();
    case INT32:
      return delegate.readInt32();
    case INT64:
      return delegate.readInt64();
    case DECIMAL128:
      return delegate.readDecimal128().bigDecimalValue().doubleValue();
    case DATE_TIME:
      return delegate.readDateTime();
    case TIMESTAMP:
      return delegate.readTimestamp().getValue();
    default:
      throw new IllegalStateException(String.format("Expected numeric bson type (double) but got %s (as json:%s)", type, toGsonToken(type)));
    }
  }
Gson library reads numbers lazily when using generic
{@link com.google.gson.internal.bind.TypeAdapters#JSON_ELEMENT} type adapter.
Number is read as string and then wrapped inside {@link LazilyParsedNumber}. This inefficiency
should only occur if reading numbers with generic JSON element API
and not using generated type adapters.
@see LazilyParsedNumber
@see com.google.gson.internal.bind.TypeAdapters#JSON_ELEMENT
mongo/src/org/immutables/mongo/bson4gson/BsonReader.java