You can try: InfoClass.Builder builder = info.toBuilder(); builder.getKeyBuilder().getPrivateBuilder().setD(ByteString.copyFrom(decryptedPrivateKey)); info = builder.build();
On Thu, Jan 6, 2011 at 5:06 AM, Scratch <[email protected]> wrote: > Hi there! > I've seen that there're new sub-builders for sub-messages (Java) but > couldn`t figure out how to use them properly. My task is to replace a > single field in a message and right now I solve it like this: > > //replace encrypted key with decrypted one > info = > > info.toBuilder().setKey(info.getKey().toBuilder().setPrivate(ECPrivateKey.newBuilder().setD(ByteString.copyFrom(decryptedPrivateKey)).build()).build()).build(); > > which looks pretty ugly to me. > Will new sub-builders help me in this situation? > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<protobuf%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. 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.
