Send feedback Class DynamicMessage (3.19.4) Stay organized with collections Save and categorize content based on your preferences.
public final class DynamicMessage extends AbstractMessage Static Methods getDefaultInstance(Descriptors.Descriptor type)
public static DynamicMessage getDefaultInstance ( Descriptors . Descriptor type ) Get aDynamicMessage representing the default instance of the given type.
newBuilder(Descriptors.Descriptor type)
public static DynamicMessage . Builder newBuilder ( Descriptors . Descriptor type ) newBuilder(Message prototype)
public static DynamicMessage . Builder newBuilder ( Message prototype ) Construct aMessage.Builder for a message of the same type asprototype, and initialize it withprototype's contents.
Parameter Name Description prototypeMessage
parseFrom(Descriptors.Descriptor type, byte[] data)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , byte [] data ) Parsedata as a message of the given type and return it.
parseFrom(Descriptors.Descriptor type, byte[] data, ExtensionRegistry extensionRegistry)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , byte [] data , ExtensionRegistry extensionRegistry ) Parsedata as a message of the given type and return it.
parseFrom(Descriptors.Descriptor type, ByteString data)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , ByteString data ) Parsedata as a message of the given type and return it.
parseFrom(Descriptors.Descriptor type, ByteString data, ExtensionRegistry extensionRegistry)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , ByteString data , ExtensionRegistry extensionRegistry ) Parsedata as a message of the given type and return it.
parseFrom(Descriptors.Descriptor type, CodedInputStream input)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , CodedInputStream input ) Parse a message of the given type from the given input stream.
parseFrom(Descriptors.Descriptor type, CodedInputStream input, ExtensionRegistry extensionRegistry)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , CodedInputStream input , ExtensionRegistry extensionRegistry ) Parse a message of the given type from the given input stream.
parseFrom(Descriptors.Descriptor type, InputStream input)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , InputStream input ) Parse a message of the given type frominput and return it.
parseFrom(Descriptors.Descriptor type, InputStream input, ExtensionRegistry extensionRegistry)
public static DynamicMessage parseFrom ( Descriptors . Descriptor type , InputStream input , ExtensionRegistry extensionRegistry ) Parse a message of the given type frominput and return it.
Methods getAllFields()
public Map<Descriptors . FieldDescriptor , Object >getAllFields () getDefaultInstanceForType()
public DynamicMessage getDefaultInstanceForType () getDescriptorForType()
public Descriptors . Descriptor getDescriptorForType () getField(Descriptors.FieldDescriptor field)
public Object getField ( Descriptors . FieldDescriptor field ) getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
public Descriptors . FieldDescriptor getOneofFieldDescriptor ( Descriptors . OneofDescriptor oneof ) TODO(jieluo): Clear it when all subclasses have implemented this method.
Overrides getParserForType()
public Parser<DynamicMessage> getParserForType () getRepeatedField(Descriptors.FieldDescriptor field, int index)
public Object getRepeatedField ( Descriptors . FieldDescriptor field , int index ) getRepeatedFieldCount(Descriptors.FieldDescriptor field)
public int getRepeatedFieldCount ( Descriptors . FieldDescriptor field ) Returns Type Description int
getSerializedSize()
public int getSerializedSize () Get the number of bytes required to encode this message. The result is only computed on the first call and memoized after that.
If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will be smaller than the actual number of bytes required and might be negative.
Returns Type Description int
Overrides getUnknownFields()
public UnknownFieldSet getUnknownFields () hasField(Descriptors.FieldDescriptor field)
public boolean hasField ( Descriptors . FieldDescriptor field ) hasOneof(Descriptors.OneofDescriptor oneof)
public boolean hasOneof ( Descriptors . OneofDescriptor oneof ) TODO(jieluo): Clear it when all subclasses have implemented this method.
Overrides isInitialized()
public boolean isInitialized () Overrides newBuilderForType()
public DynamicMessage . Builder newBuilderForType () toBuilder()
public DynamicMessage . Builder toBuilder () writeTo(CodedOutputStream output)
public void writeTo ( CodedOutputStream output ) Serializes the message and writes it tooutput. This does not flush or close the stream.
Overrides Send feedback
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License , and code samples are licensed under theApache 2.0 License . For details, see theGoogle Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.
Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-30 UTC."],[],[]]