Class RoutableFactories60.DocumentReplyFactory
java.lang.Object
com.yahoo.documentapi.messagebus.protocol.AbstractRoutableFactory
com.yahoo.documentapi.messagebus.protocol.RoutableFactories60.DocumentReplyFactory
- All Implemented Interfaces:
RoutableFactory
- Direct Known Subclasses:
RoutableFactories60.CreateVisitorReplyFactory,RoutableFactories60.DestroyVisitorReplyFactory,RoutableFactories60.DocumentIgnoredReplyFactory,RoutableFactories60.DocumentListReplyFactory,RoutableFactories60.EmptyBucketsReplyFactory,RoutableFactories60.GetBucketListReplyFactory,RoutableFactories60.GetBucketStateReplyFactory,RoutableFactories60.GetDocumentReplyFactory,RoutableFactories60.MapVisitorReplyFactory,RoutableFactories60.PutDocumentReplyFactory,RoutableFactories60.QueryResultReplyFactory,RoutableFactories60.RemoveDocumentReplyFactory,RoutableFactories60.RemoveLocationReplyFactory,RoutableFactories60.StatBucketReplyFactory,RoutableFactories60.UpdateDocumentReplyFactory,RoutableFactories60.VisitorInfoReplyFactory,RoutableFactories60.WrongDistributionReplyFactory
- Enclosing class:
- RoutableFactories60
public abstract static class RoutableFactories60.DocumentReplyFactory
extends AbstractRoutableFactory
Implements the shared factory logic required for
DocumentReply objects, and it offers a more convenient
interface for implementing RoutableFactory.- Author:
- Simon Thoresen Hult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.yahoo.messagebus.Routabledecode(com.yahoo.document.serialization.DocumentDeserializer in) This method decodes the given byte buffer to a routable.protected abstract DocumentReplydoDecode(com.yahoo.document.serialization.DocumentDeserializer buf) This method decodes a reply from the given byte buffer.protected abstract booleandoEncode(DocumentReply reply, com.yahoo.document.serialization.DocumentSerializer buf) This method encodes the given reply into the given byte buffer.booleanencode(com.yahoo.messagebus.Routable obj, com.yahoo.document.serialization.DocumentSerializer out) This method encodes the content of the given routable into a byte buffer that can later be decoded using theRoutableFactory.decode(DocumentDeserializer)method.Methods inherited from class com.yahoo.documentapi.messagebus.protocol.AbstractRoutableFactory
decodeString, encodeStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yahoo.documentapi.messagebus.protocol.RoutableFactory
encode
-
Constructor Details
-
DocumentReplyFactory
public DocumentReplyFactory()
-
-
Method Details
-
doEncode
protected abstract boolean doEncode(DocumentReply reply, com.yahoo.document.serialization.DocumentSerializer buf) This method encodes the given reply into the given byte buffer. You are guaranteed to only receive replies of the type that this factory was registered for.This method is NOT exception safe. Return false to signal failure.
- Parameters:
reply- The reply to encode.buf- The byte buffer to write to.- Returns:
- True if the message was encoded.
-
doDecode
protected abstract DocumentReply doDecode(com.yahoo.document.serialization.DocumentDeserializer buf) This method decodes a reply from the given byte buffer. You are guaranteed to only receive byte buffers generated by a previous call todoEncode(DocumentReply, com.yahoo.document.serialization.DocumentSerializer).This method is NOT exception safe. Return null to signal failure.
- Parameters:
buf- The byte buffer to read from.- Returns:
- The decoded reply.
-
encode
public boolean encode(com.yahoo.messagebus.Routable obj, com.yahoo.document.serialization.DocumentSerializer out) Description copied from interface:RoutableFactoryThis method encodes the content of the given routable into a byte buffer that can later be decoded using the
RoutableFactory.decode(DocumentDeserializer)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) Description copied from interface:RoutableFactoryThis method decodes the given byte buffer to a routable.
Return false to signal failure.
This method is NOT exception safe.
- Parameters:
in- The buffer to read from.- Returns:
- The decoded routable.
-