0

Is is possible to convert DynamicMessage to Message in proto bufs? I know Message can be converted into DynamicMessage though.

Any idea?

1 Answer 1

2

DynamicMessage implements the Message interface, so it already is a Message. Do you mean you want to convert a DynamicMessage to a specific type generated using protoc? In that case, the best thing to do is serialize the message and then parse it again.

MyMessageType.parseFrom(dynamicMessage.toByteString());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.