@Override
   public void onTag(int fieldNumber, FieldDescriptor fieldDescriptor, Object tagValue) {
      if (payloadStarted) {
         if (skipping == 0) {
            AttributeNode<FieldDescriptor, Integer> attrNode = currentNode.getChild(fieldNumber);
            if (attrNode != null) { // process only 'interesting' tags
               messageContext.markField(fieldNumber);
               attrNode.processValue(tagValue, this);
            }
         }
      } else {
         switch (fieldNumber) {
            case WrappedMessage.WRAPPED_DESCRIPTOR_FULL_NAME:
               entityTypeName = (String) tagValue;
               break;

            case WrappedMessage.WRAPPED_DESCRIPTOR_ID:
               entityTypeName = serializationContext.getTypeNameById((Integer) tagValue);
               break;

            case WrappedMessage.WRAPPED_MESSAGE:
               payload = (byte[]) tagValue;
               break;

            case WrappedMessage.WRAPPED_DOUBLE:
            case WrappedMessage.WRAPPED_FLOAT:
            case WrappedMessage.WRAPPED_INT64:
            case WrappedMessage.WRAPPED_UINT64:
            case WrappedMessage.WRAPPED_INT32:
            case WrappedMessage.WRAPPED_FIXED64:
            case WrappedMessage.WRAPPED_FIXED32:
            case WrappedMessage.WRAPPED_BOOL:
            case WrappedMessage.WRAPPED_STRING:
            case WrappedMessage.WRAPPED_BYTES:
            case WrappedMessage.WRAPPED_UINT32:
            case WrappedMessage.WRAPPED_SFIXED32:
            case WrappedMessage.WRAPPED_SFIXED64:
            case WrappedMessage.WRAPPED_SINT32:
            case WrappedMessage.WRAPPED_SINT64:
            case WrappedMessage.WRAPPED_ENUM:
               break;
            // this is a primitive value, which we ignore for now due to lack of support for querying primitives

            default:
               throw new IllegalStateException("Unexpected field : " + fieldNumber);
         }
      }
   }
@ Override public void onTag ( int fieldNumber , FieldDescriptor fieldDescriptor , Object tagValue ) { if ( payloadStarted ) { if ( skipping == 0 ) { AttributeNode < FieldDescriptor , Integer > attrNode = currentNode . getChild ( fieldNumber ) ; if ( attrNode != null ) { messageContext . markField ( fieldNumber ) ; attrNode . processValue ( tagValue , this ) ; } } } else { switch ( fieldNumber ) { case WrappedMessage . WRAPPED_DESCRIPTOR_FULL_NAME : entityTypeName = ( String ) tagValue ; break ; case WrappedMessage . WRAPPED_DESCRIPTOR_ID : entityTypeName = serializationContext . getTypeNameById ( ( Integer ) tagValue ) ; break ; case WrappedMessage . WRAPPED_MESSAGE : payload = ( byte [ ] ) tagValue ; break ; case WrappedMessage . WRAPPED_DOUBLE : case WrappedMessage . WRAPPED_FLOAT : case WrappedMessage . WRAPPED_INT64 : case WrappedMessage . WRAPPED_UINT64 : case WrappedMessage . WRAPPED_INT32 : case WrappedMessage . WRAPPED_FIXED64 : case WrappedMessage . WRAPPED_FIXED32 : case WrappedMessage . WRAPPED_BOOL : case WrappedMessage . WRAPPED_STRING : case WrappedMessage . WRAPPED_BYTES : case WrappedMessage . WRAPPED_UINT32 : case WrappedMessage . WRAPPED_SFIXED32 : case WrappedMessage . WRAPPED_SFIXED64 : case WrappedMessage . WRAPPED_SINT32 : case WrappedMessage . WRAPPED_SINT64 : case WrappedMessage . WRAPPED_ENUM : break ; default : throw new IllegalStateException ( "Unexpected field : " + fieldNumber ) ; } } }
todo [anistor] missing tags need to be fired with default value defined in proto schema or null if they admit null; missing messages need to be fired with null at end of the nesting level. BTW, seems like this is better to be included in Protostream as a feature