@Override public PhoneNumber readFrom(ProtoStreamReader reader) throws IOException { String number = reader.readString("number"); PhoneType type = reader.readObject("type", PhoneType.class); PhoneNumber phoneNumber = new PhoneNumber(); phoneNumber.setNumber(number); phoneNumber.setType(type); return phoneNumber; }
@Override public void writeTo(ProtoStreamWriter writer, PhoneNumber phoneNumber) throws IOException { writer.writeString("number", phoneNumber.getNumber()); writer.writeObject("type", phoneNumber.getType(), PhoneType.class); }