Classes | Public Member Functions | Private Attributes | List of all members
com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper Class Reference
Inheritance diagram for com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper:
Inheritance graph
[legend]

Classes

class  Builder
 

Public Member Functions

 AbstractMessageWrapper (Message wrappedMessage)
 
Map< Descriptors.FieldDescriptor, Object > getAllFields ()
 
AbstractMessageWrapper getDefaultInstanceForType ()
 
Descriptors.Descriptor getDescriptorForType ()
 
Object getField (Descriptors.FieldDescriptor field)
 
Parser<? extends MessagegetParserForType ()
 
Object getRepeatedField (Descriptors.FieldDescriptor field, int index)
 
int getRepeatedFieldCount (Descriptors.FieldDescriptor field)
 
UnknownFieldSet getUnknownFields ()
 
boolean hasField (Descriptors.FieldDescriptor field)
 
Builder newBuilderForType ()
 
Builder toBuilder ()
 
- Public Member Functions inherited from com.google.protobuf.AbstractMessage
boolean equals (final Object other)
 
List< String > findInitializationErrors ()
 
String getInitializationErrorString ()
 
FieldDescriptor getOneofFieldDescriptor (OneofDescriptor oneof)
 
int getSerializedSize ()
 
int hashCode ()
 
boolean hasOneof (OneofDescriptor oneof)
 
boolean isInitialized ()
 
final String toString ()
 
void writeTo (final CodedOutputStream output) throws IOException
 
- Public Member Functions inherited from com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >
byte[] toByteArray ()
 
ByteString toByteString ()
 
void writeDelimitedTo (final OutputStream output) throws IOException
 
void writeTo (final OutputStream output) throws IOException
 
- Public Member Functions inherited from com.google.protobuf.MessageOrBuilder
Descriptors.FieldDescriptor getOneofFieldDescriptor (Descriptors.OneofDescriptor oneof)
 
boolean hasOneof (Descriptors.OneofDescriptor oneof)
 

Private Attributes

final Message wrappedMessage
 

Additional Inherited Members

- Protected Member Functions inherited from com.google.protobuf.AbstractMessage
Message.Builder newBuilderForType (BuilderParent parent)
 
- Static Protected Member Functions inherited from com.google.protobuf.AbstractMessage
static int hashBoolean (boolean b)
 
static int hashEnum (EnumLite e)
 
static int hashEnumList (List<? extends EnumLite > list)
 
static int hashFields (int hash, Map< FieldDescriptor, Object > map)
 
static int hashLong (long n)
 
- Static Protected Member Functions inherited from com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >
static< T > void addAll (final Iterable< T > values, final Collection<? super T > list)
 
static< T > void addAll (final Iterable< T > values, final List<? super T > list)
 
static void checkByteStringIsUtf8 (ByteString byteString) throws IllegalArgumentException
 
- Protected Attributes inherited from com.google.protobuf.AbstractMessage
int memoizedSize = -1
 
- Protected Attributes inherited from com.google.protobuf.AbstractMessageLite< MessageType extends AbstractMessageLite< MessageType, BuilderType, BuilderType extends AbstractMessageLite.Builder< MessageType, BuilderType >
int memoizedHashCode = 0
 

Detailed Description

Extends AbstractMessage and wraps some other message object. The methods of the Message interface which aren't explicitly implemented by AbstractMessage are forwarded to the wrapped object. This allows us to test that AbstractMessage's implementations work even if the wrapped object does not use them.

Definition at line 61 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

Constructor & Destructor Documentation

◆ AbstractMessageWrapper()

com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.AbstractMessageWrapper ( Message  wrappedMessage)
inline

Member Function Documentation

◆ getAllFields()

Map<Descriptors.FieldDescriptor, Object> com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getAllFields ( )
inline

Returns a collection of all the fields in this message which are set and their corresponding values. A singular ("required" or "optional") field is set iff hasField() returns true for that field. A "repeated" field is set iff getRepeatedFieldCount() is greater than zero. The values are exactly what would be returned by calling 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.
If this is for a builder, the returned map may or may not reflect future changes to the builder. Either way, the returned map is itself unmodifiable.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 79 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getDefaultInstanceForType()

AbstractMessageWrapper com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getDefaultInstanceForType ( )
inline

Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the

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.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 74 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getDescriptorForType()

Descriptors.Descriptor com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getDescriptorForType ( )
inline

Get the message's type's descriptor. This differs from the

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.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 69 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getField()

Object com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getField ( Descriptors.FieldDescriptor  field)
inline

Obtains the value of the given field, or the default value if it is not set. For primitive fields, the boxed primitive value is returned. For enum fields, the EnumValueDescriptor for the value is returned. For embedded message fields, the sub-message is returned. For repeated fields, a java.util.List is returned.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 89 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getParserForType()

Parser<? extends Message> com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getParserForType ( )
inline

Gets the parser for a message of the same type as this message.

Implements com.google.protobuf.Message.

Definition at line 227 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getRepeatedField()

Object com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getRepeatedField ( Descriptors.FieldDescriptor  field,
int  index 
)
inline

Gets an element of a repeated field. For primitive fields, the boxed primitive value is returned. For enum fields, the EnumValueDescriptor for the value is returned. For embedded message fields, the sub-message is returned.

Exceptions
IllegalArgumentExceptionThe field is not a repeated field, or
field.getContainingType() != getDescriptorForType()
.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 99 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getRepeatedFieldCount()

int com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getRepeatedFieldCount ( Descriptors.FieldDescriptor  field)
inline

Gets the number of elements of a repeated field. This is exactly equivalent to calling the generated "Count" accessor method corresponding to the field.

Exceptions
IllegalArgumentExceptionThe field is not a repeated field, or
field.getContainingType() != getDescriptorForType()
.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 94 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ getUnknownFields()

UnknownFieldSet com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getUnknownFields ( )
inline

◆ hasField()

boolean com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.hasField ( Descriptors.FieldDescriptor  field)
inline

Returns true if the given field is set. This is exactly equivalent to calling the generated "has" accessor method corresponding to the field.

Exceptions
IllegalArgumentExceptionThe field is a repeated field, or
field.getContainingType() != getDescriptorForType()
.

Implements com.google.protobuf.MessageOrBuilder.

Definition at line 84 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ newBuilderForType()

Builder com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.newBuilderForType ( )
inline

Constructs a new builder for a message of the same type as this message.

Implements com.google.protobuf.Message.

Definition at line 109 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

◆ toBuilder()

Builder com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.toBuilder ( )
inline

Constructs a builder initialized with the current message. Use this to derive a new message from the current one.

Implements com.google.protobuf.Message.

Definition at line 114 of file core/src/test/java/com/google/protobuf/AbstractMessageTest.java.

Member Data Documentation

◆ wrappedMessage

final Message com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.wrappedMessage
private

The documentation for this class was generated from the following file:
field
const FieldDescriptor * field
Definition: parser_unittest.cc:2694
com.google.protobuf.AbstractMessageTest.AbstractMessageWrapper.getDescriptorForType
Descriptors.Descriptor getDescriptorForType()
Definition: core/src/test/java/com/google/protobuf/AbstractMessageTest.java:69


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:06