Skip to content

Commit

Permalink
Internal Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 653232322
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jul 17, 2024
1 parent b1c0715 commit bbf574b
Showing 1 changed file with 63 additions and 61 deletions.
124 changes: 63 additions & 61 deletions java/core/src/main/java/com/google/protobuf/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,68 +102,106 @@ interface Builder extends MessageLite.Builder, MessageOrBuilder {
@CanIgnoreReturnValue
Builder mergeFrom(Message other);

@Override
@CanIgnoreReturnValue
Builder mergeFrom(CodedInputStream input) throws IOException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
throws IOException;

// ---------------------------------------------------------------
// Convenience methods.

// (From MessageLite.Builder, re-declared here only for return type
// covariance.)
@Override
Message build();
@CanIgnoreReturnValue
Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException;

@Override
Message buildPartial();
@CanIgnoreReturnValue
Builder mergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException;

@Override
Builder clone();
@CanIgnoreReturnValue
Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(CodedInputStream input) throws IOException;
Builder mergeFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Builder mergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(InputStream input) throws IOException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
throws IOException;

// (From MessageLite.Builder, re-declared here only for return type
// covariance.)
@Override
Message build();

@Override
Message buildPartial();

@Override
Builder clone();

/** Get the message's type's descriptor. See {@link Message#getDescriptorForType()}. */
@Override
Descriptors.Descriptor getDescriptorForType();

/**
* Create a builder for messages of the appropriate type for the given field. The
* builder is NOT nested in the current builder. However, messages built with the
* builder can then be passed to the {@link #setField(Descriptors.FieldDescriptor, Object)},
* {@link #setRepeatedField(Descriptors.FieldDescriptor, int, Object)}, or
* {@link #addRepeatedField(Descriptors.FieldDescriptor, Object)}
* method of the current builder.
* Create a builder for messages of the appropriate type for the given field. The builder is NOT
* nested in the current builder. However, messages built with the builder can then be passed to
* the {@link #setField(Descriptors.FieldDescriptor, Object)}, {@link
* #setRepeatedField(Descriptors.FieldDescriptor, int, Object)}, or {@link
* #addRepeatedField(Descriptors.FieldDescriptor, Object)} method of the current builder.
*
* <p>To obtain a builder nested in the current builder, use
* {@link #getFieldBuilder(Descriptors.FieldDescriptor)} instead.
* <p>To obtain a builder nested in the current builder, use {@link
* #getFieldBuilder(Descriptors.FieldDescriptor)} instead.
*/
Builder newBuilderForField(Descriptors.FieldDescriptor field);

/**
* Get a nested builder instance for the given field.
*
* <p>Normally, we hold a reference to the immutable message object for the message type field.
* Some implementations (the generated message builders) can also hold a reference to
* the builder object (a nested builder) for the field.
* Some implementations (the generated message builders) can also hold a reference to the
* builder object (a nested builder) for the field.
*
* <p>If the field is already backed up by a nested builder, the nested builder is
* returned. Otherwise, a new field builder is created and returned. The original message
* field (if one exists) is merged into the field builder, which is then nested into its
* parent builder.
* <p>If the field is already backed up by a nested builder, the nested builder is returned.
* Otherwise, a new field builder is created and returned. The original message field (if one
* exists) is merged into the field builder, which is then nested into its parent builder.
*/
Builder getFieldBuilder(Descriptors.FieldDescriptor field);

/**
* Get a nested builder instance for the given repeated field instance.
*
* <p>Normally, we hold a reference to the immutable message object for the message type field.
* Some implementations (the generated message builders) can also hold a reference to
* the builder object (a nested builder) for the field.
* Some implementations (the generated message builders) can also hold a reference to the
* builder object (a nested builder) for the field.
*
* <p>If the field is already backed up by a nested builder, the nested builder is
* returned. Otherwise, a new field builder is created and returned. The original message
* field (if one exists) is merged into the field builder, which is then nested into its
* parent builder.
* <p>If the field is already backed up by a nested builder, the nested builder is returned.
* Otherwise, a new field builder is created and returned. The original message field (if one
* exists) is merged into the field builder, which is then nested into its parent builder.
*/
Builder getRepeatedFieldBuilder(Descriptors.FieldDescriptor field, int index);

Expand Down Expand Up @@ -221,42 +259,6 @@ Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistr

// (From MessageLite.Builder, re-declared here only for return type
// covariance.)
@Override
@CanIgnoreReturnValue
Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(byte[] data, int off, int len, ExtensionRegistryLite extensionRegistry)
throws InvalidProtocolBufferException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(InputStream input) throws IOException;

@Override
@CanIgnoreReturnValue
Builder mergeFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
throws IOException;

@Override
boolean mergeDelimitedFrom(InputStream input) throws IOException;

Expand Down

0 comments on commit bbf574b

Please sign in to comment.