Class RoutableFactories60.DocumentMessageFactory

    • Constructor Detail

      • DocumentMessageFactory

        public DocumentMessageFactory()
    • Method Detail

      • doEncode

        protected abstract boolean doEncode​(DocumentMessage msg,
                                            com.yahoo.document.serialization.DocumentSerializer serializer)
        This method encodes the given message using the given serializer. You are guaranteed to only receive messages of the type that this factory was registered for.

        This method is NOT exception safe. Return false to signal failure.

        Parameters:
        msg - The message to encode.
        serializer - The serializer to use for encoding.
        Returns:
        True if the message was encoded.
      • doDecode

        protected abstract DocumentMessage doDecode​(com.yahoo.document.serialization.DocumentDeserializer deserializer)
        This method decodes a message from the given deserializer. You are guaranteed to only receive byte buffers generated by a previous call to doEncode(DocumentMessage, DocumentSerializer).

        This method is NOT exception safe. Return null to signal failure.

        Parameters:
        deserializer - The deserializer to use for decoding.
        Returns:
        The decoded message.
      • encode

        public boolean encode​(com.yahoo.messagebus.Routable obj,
                              com.yahoo.document.serialization.DocumentSerializer out)
        Description copied from interface: RoutableFactory

        This method encodes the content of the given routable into a byte buffer that can later be decoded using the RoutableFactory.decode(DocumentDeserializer, com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet) method.

        Return false to signal failure.

        This method is NOT exception safe.

        Parameters:
        obj - The routable to encode.
        out - The buffer to write into.
        Returns:
        True if the routable could be encoded.
      • decode

        public com.yahoo.messagebus.Routable decode​(com.yahoo.document.serialization.DocumentDeserializer in,
                                                    LoadTypeSet loadTypes)
        Description copied from interface: RoutableFactory

        This method decodes the given byte bufer to a routable.

        Return false to signal failure.

        This method is NOT exception safe.

        Parameters:
        in - The buffer to read from.
        loadTypes - The LoadTypeSet to inject into the Routable.
        Returns:
        The decoded routable.