com.googlecode.mobilityrpc.protocol.converters
Class MessageConverter<T>

java.lang.Object
  extended by com.googlecode.mobilityrpc.protocol.converters.MessageConverter<T>
Direct Known Subclasses:
EnvelopeMessageConverter, ExecutionRequestMessageConverter, ExecutionResponseMessageConverter, MasterMessageConverter, PingMessageConverter, PongMessageConverter, ResourceRequestMessageConverter, ResourceResponseMessageConverter

public abstract class MessageConverter<T>
extends Object

Interface implemented by classes which can convert Java object (POJO) representations of messages to/from binary using protobuf.

Author:
Niall Gallagher

Constructor Summary
MessageConverter()
           
 
Method Summary
 T convertFromProtobuf(byte[] bytes)
           
 byte[] convertToProtobuf(T object)
           
protected abstract  T fromProtobuf(byte[] bytes)
           
protected abstract  byte[] toProtobuf(T object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageConverter

public MessageConverter()
Method Detail

convertFromProtobuf

public final T convertFromProtobuf(byte[] bytes)

convertToProtobuf

public final byte[] convertToProtobuf(T object)

fromProtobuf

protected abstract T fromProtobuf(byte[] bytes)
                           throws Exception
Throws:
Exception

toProtobuf

protected abstract byte[] toProtobuf(T object)
                              throws Exception
Throws:
Exception


Copyright © 2016. All rights reserved.