Package org.infinispan.client.hotrod.protostream.domain.marshallers

Source Code of org.infinispan.client.hotrod.protostream.domain.marshallers.AddressMarshaller

package org.infinispan.client.hotrod.protostream.domain.marshallers;

import org.infinispan.client.hotrod.protostream.domain.Address;
import org.infinispan.protostream.MessageMarshaller;

import java.io.IOException;

/**
* @author anistor@redhat.com
*/
public class AddressMarshaller implements MessageMarshaller<Address> {

   @Override
   public String getFullName() {
      return "sample_bank_account.User.Address";
   }

   @Override
   public Address readFrom(ProtobufReader reader) throws IOException {
      String street = reader.readString("street");
      String postCode = reader.readString("postCode");

      Address address = new Address();
      address.setStreet(street);
      address.setPostCode(postCode);
      return address;
   }

   @Override
   public void writeTo(ProtobufWriter writer, Address address) throws IOException {
      writer.writeString("street", address.getStreet());
      writer.writeString("postCode", address.getPostCode());
   }
}
TOP

Related Classes of org.infinispan.client.hotrod.protostream.domain.marshallers.AddressMarshaller

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.