From 3fafa8c30479a2489453c8a75ffef563a8b7c933 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 2 Jul 2024 13:45:02 -0700 Subject: [PATCH] Document Java Any exemplar APIs. These APIs were added in protocolbuffers/protobuf@60b71498d70a5645324385269c518b95c8c2feb0. --- content/reference/java/java-generated.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/reference/java/java-generated.md b/content/reference/java/java-generated.md index b30d50cbb..399840729 100644 --- a/content/reference/java/java-generated.md +++ b/content/reference/java/java-generated.md @@ -675,10 +675,19 @@ class Any { // Checks whether this Any message’s payload is the given type. public boolean is(class clazz); + // Checks whether this Any message’s payload has the same type as the given + // message. + public boolean isSameTypeAs(Message message); + // Unpacks Any into the given message type. Throws exception if // the type doesn’t match or parsing the payload has failed. public T unpack(class clazz) throws InvalidProtocolBufferException; + + // Unpacks Any into a message with the same type as the given messsage. + // Throws exception if the type doesn’t match or parsing the payload fails. + public T unpackSameTypeAs(T message) + throws InvalidProtocolBufferException; } ```