proto library Client - Class FieldDescriptor (v5.36.2)

Namespace

Google \ Protobuf

Methods

__construct

Parameter
Name Description
internal_desc mixed

getName

Returns
Type Description
string Field name

getNumber

Returns
Type Description
int Protobuf field number

isRequired

Returns
Type Description
bool

isRepeated

Returns
Type Description
bool

getType

Returns
Type Description
int

getContainingOneof

Returns
Type Description
OneofDescriptor

getRealContainingOneof

Gets the field's containing oneof, only if non-synthetic.

Returns
Type Description
null|OneofDescriptor

hasPresence

Returns true if this field tracks presence, ie. does the field distinguish between "unset" and "present with default value."

This includes required, optional, and oneof fields. It excludes maps, repeated fields, and singular proto3 fields without "optional".

For fields where hasPresence() == true, the return value of msg.hasField() is semantically meaningful.

Returns
Type Description
bool

getMessageType

Returns
Type Description
Descriptor Returns a descriptor for the field type if the field type is a message, otherwise throws \Exception

getEnumType

Returns
Type Description
EnumDescriptor Returns an enum descriptor if the field type is an enum, otherwise throws \Exception

isMap

Returns
Type Description
bool