mongo/src/org/immutables/mongo/bson4gson/BsonReader.java
private String scalarToString() {
    switch (delegate.getCurrentBsonType()) {
    case STRING:
      return delegate.readString();
    case SYMBOL:
      return delegate.readSymbol();
    case INT32:
      return Integer.toString(delegate.readInt32());
    case INT64:
      return Long.toString(delegate.readInt64());
    case DOUBLE:
      return Double.toString(delegate.readDouble());
    case DECIMAL128:
      return delegate.readDecimal128().toString();
    default:
      throw new IllegalStateException(
          "Unknown scalar type to be converted to string: " + delegate.getCurrentBsonType());
    }
  }
private String scalarToString() {
    switch (delegate.getCurrentBsonType()) {
    case STRING:
      return delegate.readString();
    case SYMBOL:
      return delegate.readSymbol();
    case INT32:
      return Integer.toString(delegate.readInt32());
    case INT64:
      return Long.toString(delegate.readInt64());
    case DOUBLE:
      return Double.toString(delegate.readDouble());
    case DECIMAL128:
      return delegate.readDecimal128().toString();
    default:
      throw new IllegalStateException(
          "Unknown scalar type to be converted to string: " + delegate.getCurrentBsonType());
    }
  }
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