Open
Description
Currently the ProtobufParser uses a condition (isStdEnum) to know it we need to deserialize using the index form or string form.
case ENUM:
// 12-Feb-2015, tatu: Can expose as index (int) or name, but internally encoded as VInt.
// So for now, expose as is; may add a feature to choose later on.
// But! May or may not be directly mapped; may need to translate
{
int ix = _decodeLength();
if (_currentField.isStdEnum) {
_numberInt = ix;
_numTypesValid = NR_INT;
type = JsonToken.VALUE_NUMBER_INT;
} else {
// Could translate to better id, but for now let databind
// handle that part
String enumStr = _currentField.findEnumByIndex(ix);
if (enumStr == null) {
_reportErrorF("Unknown id %d (for enum field %s)", ix, _currentField.name);
}
type = JsonToken.VALUE_STRING;
_textBuffer.resetWithString(enumStr);
}
}
break;
We could honor the READ_ENUMS_USING_TO_STRING feature so we return the string form when this feature is enabled.