Skip to content

Instantly share code, notes, and snippets.

@galderz
Created June 27, 2018 11:35
Show Gist options
  • Save galderz/4170abb6dd522ac3250989d8e842ab90 to your computer and use it in GitHub Desktop.
Save galderz/4170abb6dd522ac3250989d8e842ab90 to your computer and use it in GitHub Desktop.
import org.infinispan.protostream.MessageMarshaller;
public class CryptoCurrencyMarshaller implements MessageMarshaller<CryptoCurrency> {
@Override
public CryptoCurrency readFrom(ProtoStreamReader reader) throws IOException {
String description = reader.readString("description");
Integer rank = reader.readInt("rank");
return new CryptoCurrency(description, rank);
}
@Override
public void writeTo(ProtoStreamWriter writer, CryptoCurrency obj) throws IOException {
writer.writeString("description", obj.description);
writer.writeInt("rank", obj.rank);
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment