The terms 'scalar type' or 'scalar field' are usually used to contrast them with compound types/fields. A compound type is easiest to define and it is a type that contains multiple distinct elements. These elements can have the same type, in which case the compound is an array or a list, or different types, in which case the compound is typically a struct or a class.
A scalar type is a type that contains only a single element.
The set of scalar types contains at least the primitive types, but it might also contain String types, depending on how the community looks at those types. Typically, if a language (or specification like Protocol Buffers) contains a distinct type for storing string data, as opposed to storing strings as an array of characters, then those string types are considered to be scalar types.
To understand the mergeFrom
function, you don't need to know what Java considers to be scalars or compound fields, but what Protocol Buffers considers to be scalar or compound.
The list of scalar types in Protocol Buffers is listed here. It consists of primitive types (floating point, integers, booleans, etc.) and string types.
Compound types correspond to the (user-defined) Messages within Protocol Buffers.
Enumeration types may be an odd-one out here. They are formally documented as compound types, but my guess is that the merging semantics are likely to be closer to that of scalar types.
As the java.Object
class does not have a meaning within the context of Protocol Buffers, it also makes no sense of talking about merging it. The behaviour of the function also appears to only be defined when merging two messages of the same type.