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
getRealContainingOneof
Gets the field's containing oneof, only if non-synthetic.
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 |
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-01 UTC."],[],[]]