Reference documentation and code samples for the proto library Client class Field.
A single field of a message type.
New usages of this message as an alternative to FieldDescriptorProto are strongly discouraged. This message does not reliability preserve all information necessary to model the schema and preserve semantics. Instead make use of FileDescriptorSet which preserves the necessary information.
Generated from protobuf message google.protobuf.Field
Namespace
Google \ ProtobufMethods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ kind |
int
The field type. |
↳ cardinality |
int
The field cardinality. |
↳ number |
int
The field number. |
↳ name |
string
The field name. |
↳ type_url |
string
The field type URL, without the scheme, for message or enumeration types. Example: |
↳ oneof_index |
int
The index of the field type in |
↳ packed |
bool
Whether to use alternative packed wire representation. |
↳ options |
array<Option>
The protocol buffer options. |
↳ json_name |
string
The field JSON name. |
↳ default_value |
string
The string value of the default value of this field. Proto2 syntax only. |
getKind
The field type.
| Returns | |
|---|---|
| Type | Description |
int |
Enum of type Kind. one of the values in {@see \Google\Protobuf\Field\Kind} |
setKind
The field type.
| Parameter | |
|---|---|
| Name | Description |
var |
int
Enum of type Kind. one of the values in Field\Kind |
| Returns | |
|---|---|
| Type | Description |
$this |
|
getCardinality
The field cardinality.
| Returns | |
|---|---|
| Type | Description |
int |
Enum of type Cardinality. one of the values in {@see \Google\Protobuf\Field\Cardinality} |
setCardinality
The field cardinality.
| Parameter | |
|---|---|
| Name | Description |
var |
int
Enum of type Cardinality. one of the values in Field\Cardinality |
| Returns | |
|---|---|
| Type | Description |
$this |
|
getNumber
The field number.
| Returns | |
|---|---|
| Type | Description |
int |
|
setNumber
The field number.
| Parameter | |
|---|---|
| Name | Description |
var |
int
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getName
The field name.
| Returns | |
|---|---|
| Type | Description |
string |
|
setName
The field name.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getTypeUrl
The field type URL, without the scheme, for message or enumeration
types. Example: "type.googleapis.com/google.protobuf.Timestamp".
| Returns | |
|---|---|
| Type | Description |
string |
|
setTypeUrl
The field type URL, without the scheme, for message or enumeration
types. Example: "type.googleapis.com/google.protobuf.Timestamp".
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getOneofIndex
The index of the field type in Type.oneofs, for message or enumeration
types. The first type has index 1; zero means the type is not in the list.
| Returns | |
|---|---|
| Type | Description |
int |
|
setOneofIndex
The index of the field type in Type.oneofs, for message or enumeration
types. The first type has index 1; zero means the type is not in the list.
| Parameter | |
|---|---|
| Name | Description |
var |
int
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getPacked
Whether to use alternative packed wire representation.
| Returns | |
|---|---|
| Type | Description |
bool |
|
setPacked
Whether to use alternative packed wire representation.
| Parameter | |
|---|---|
| Name | Description |
var |
bool
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getOptions
The protocol buffer options.
| Returns | |
|---|---|
| Type | Description |
RepeatedField<Option> |
|
setOptions
The protocol buffer options.
| Parameter | |
|---|---|
| Name | Description |
var |
array<Option>
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getJsonName
The field JSON name.
| Returns | |
|---|---|
| Type | Description |
string |
|
setJsonName
The field JSON name.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|
getDefaultValue
The string value of the default value of this field. Proto2 syntax only.
| Returns | |
|---|---|
| Type | Description |
string |
|
setDefaultValue
The string value of the default value of this field. Proto2 syntax only.
| Parameter | |
|---|---|
| Name | Description |
var |
string
|
| Returns | |
|---|---|
| Type | Description |
$this |
|