@Override
  public BigDecimal getDecimalValue() throws IOException {
    final BsonType type = type();
    switch (type) {
      case DOUBLE:
        return BigDecimal.valueOf(getNumberValue().doubleValue());
      case INT32:
        return new BigDecimal(getNumberValue().intValue());
      case INT64:
        return BigDecimal.valueOf(getNumberValue().longValue());
      case DECIMAL128:
      case STRING:
        return (BigDecimal) getNumberValue();
      default:
        throw new IllegalStateException(String.format("Can't convert %s to %s", type, BigDecimal.class.getName()));
    }
  }
The ObjectCodec used to parse the Bson object(s)
mongo/src/org/immutables/mongo/bson4jackson/BsonParser.java