use case (written in Java):

public class MyService {

        private final ServiceDAO serviceDAO;

        // constructor, getters, setters

        public void handleRequest(InputStream in, OutputStream out) {
                List<String> results = serviceDAO.findAllCodes();
                // create the collection builder for MyMessage instance
                MyProtos.MyMessage.CollectionBuilder collectionBuilder =
MyProtos.MyMessage.newCollectionBuilder();
                for(String code: results) {
                        // create the single MyMessage instance
                        final MyProtos.MyMessage message = 
MyProtos.MyMessage.newBuilder
().setCode(code).build();
                        collectionBuilder.add(message);
                }
                collectionBuilder.build().writeTo(out); // this will result 
writing
of the repeated items
        }

}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to