Import and usage of different package files
syntax="proto3";
package example;
import "google/protobuf/field_mask.proto";
message UpdateRequest {
google.protobuf.FieldMask update_mask = 1;
}
Any
class Any {
public static Any pack(Message message);
public static Any pack(Message message, String typeUrlPrefix);
// Checks whether this Any message’s payload is the given type.
public <T extends Message> boolean is(class<T> clazz);
// Unpacks Any into the given message type. Throws exception if
// the type doesn’t match or parsing the payload has failed.
public <T extends Message> T unpack(class<T> clazz)
throws InvalidProtocolBufferException;
}
Field Masks
FieldMaskUtil
public static void merge(
FieldMask mask, Message source, Message.Builder destination, MergeOptions options);
- FieldMaskUtil.merge(fieldMask, incomingMessage, storedMessageBuilder, options)
Default MergeOptions
[deprecated = true]
enum
enum the_proto_enum {
UNKNOWN = 0;
}
Misc Tips
- use
THE_PROTO.getDefaultInstance()
instead ofTHE_PROTO.newBuilder().build()