public interface MessageOrBuilder extends MessageLiteOrBuilder
Message
and Message.Builder
to provide type
equivalency.Modifier and Type | Method and Description |
---|---|
List<String> |
findInitializationErrors()
Returns a list of field paths (e.g.
|
Map<Descriptors.FieldDescriptor,Object> |
getAllFields()
Returns a collection of all the fields in this message which are set and their corresponding
values.
|
Message |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor.
|
Object |
getField(Descriptors.FieldDescriptor field)
Obtains the value of the given field, or the default value if it is not set.
|
String |
getInitializationErrorString()
Returns a comma-delimited list of required fields which are not set in this message object.
|
Descriptors.FieldDescriptor |
getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
Obtains the FieldDescriptor if the given oneof is set.
|
Object |
getRepeatedField(Descriptors.FieldDescriptor field,
int index)
Gets an element of a repeated field.
|
int |
getRepeatedFieldCount(Descriptors.FieldDescriptor field)
Gets the number of elements of a repeated field.
|
UnknownFieldSet |
getUnknownFields()
Get the
UnknownFieldSet for this message. |
boolean |
hasField(Descriptors.FieldDescriptor field)
Returns true if the given field is set.
|
boolean |
hasOneof(Descriptors.OneofDescriptor oneof)
Returns true if the given oneof is set.
|
isInitialized
Message getDefaultInstanceForType()
MessageLiteOrBuilder
getDefaultInstance()
method of generated
message classes in that this method is an abstract method of the MessageLite
interface
whereas getDefaultInstance()
is a static method of a specific class. They return the
same thing.getDefaultInstanceForType
in interface MessageLiteOrBuilder
List<String> findInitializationErrors()
MessageLiteOrBuilder.isInitialized()
first to check if there
are any missing fields, as that method is likely to be much faster than this one even when the
message is fully-initialized.String getInitializationErrorString()
MessageLiteOrBuilder.isInitialized()
first to check if there are any
missing fields, as that method is likely to be much faster than this one even when the message
is fully-initialized.Descriptors.Descriptor getDescriptorForType()
getDescriptor()
method of
generated message classes in that this method is an abstract method of the Message
interface whereas getDescriptor()
is a static method of a specific class. They return
the same thing.Map<Descriptors.FieldDescriptor,Object> getAllFields()
getField(Descriptors.FieldDescriptor)
for each field. The map is guaranteed to be a sorted map, so iterating over it will return
fields in order by field number. boolean hasOneof(Descriptors.OneofDescriptor oneof)
IllegalArgumentException
- if oneof.getContainingType() !=
getDescriptorForType()
.Descriptors.FieldDescriptor getOneofFieldDescriptor(Descriptors.OneofDescriptor oneof)
boolean hasField(Descriptors.FieldDescriptor field)
IllegalArgumentException
- The field is a repeated field, or field.getContainingType() != getDescriptorForType()
.Object getField(Descriptors.FieldDescriptor field)
int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
IllegalArgumentException
- The field is not a repeated field, or field.getContainingType() != getDescriptorForType()
.Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
IllegalArgumentException
- The field is not a repeated field, or field.getContainingType() != getDescriptorForType()
.UnknownFieldSet getUnknownFields()
UnknownFieldSet
for this message.Copyright © 2008–2020. All rights reserved.