I'm trying to override JsonWriter's doWriteInt64 so that it writes values with just Long.toString() representation.
In the code, there's:
@Override protected void doWriteInt64(final long value) { try { switch (settings.getOutputMode()) { case STRICT: writeStartDocument(); writeNameHelper("$numberLong"); writer.write(format("\"%d\"", value)); writeEndDocument(); break; case SHELL: writeNameHelper(getName()); if (value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE) { writer.write(format("NumberLong(%d)", value)); } else { writer.write(format("NumberLong(\"%d\")", value)); } break; default: writeNameHelper(getName()); writer.write(Long.toString(value)); break; } } catch (IOException e) { throwBSONException(e); } }
but, if I've understood correctly the code, the "default" never gets called, because outputMode will always be either STRICT or SHELL.
I've tried to override and write my own version (just copy the "default:" code), but writeNameHelper is private and I can't access it.
Can you make it at least protected?