Constructs a new message field instance. Note that map fields have their own class.
Parameters:
name |
string |
Unique name within its namespace |
|
id |
number |
Unique id within its namespace |
|
type |
string |
Value type |
|
rule |
string | Object.<string, *> | "optional" |
optional
Field rule |
extend |
string | Object.<string, *> |
optional
Extended type if different from parent |
|
options |
Object.<string, *> |
optional
Declared options |
Extends
Members
-
Whether this field's value is a buffer.
-
Comment for this field.
-
Sister-field within the declaring namespace if an extended field.
-
The field's default value on prototypes.
-
Determines whether this field uses tag-delimited encoding. In proto2 this
corresponded to group syntax. -
Extended type if different from parent.
-
Sister-field within the extended type if a declaring extension field.
-
Defining file name.
-
Full name including leading dot.
-
Determines whether this field tracks presence.
-
Unique field id.
-
Whether this field's value should be treated as a long.
-
Whether this field is a map or not.
-
Message this field belongs to.
-
Unique name within its namespace.
-
Determines whether this field is not required.
-
Options.
-
Determines whether this field is packed. Only relevant when repeated.
-
Parent namespace.
-
Parsed Options.
-
OneOf this field belongs to, if any,
-
Whether this field is repeated.
-
Determines whether this field is required.
-
Whether already resolved or not.
-
Resolved type if not a basic type.
-
Reference to the root namespace.
-
Field type.
-
The field type's default value.
Methods
-
Gets an option value.
Parameters:
namestring Option name
Returns:
* Option value or undefinedif not set -
Called when this object is added to a parent.
Parameters:
parentReflectionObject Parent added to
Returns:
undefined -
Called when this object is removed from a parent.
Parameters:
parentReflectionObject Parent removed from
Returns:
undefined -
Resolves this field's type references.
Throws:
Error If any reference cannot be resolved
Returns:
Field this -
inherited setOptions(options, ifNotSet){ ReflectionObject }
-
Sets multiple options.
Parameters:
optionsObject.<string, *> Options to set
ifNotSetboolean optional Sets an option only if it isn't currently set
Returns:
ReflectionObject this -
inherited setParsedOption(name, value, propName){ ReflectionObject }
-
Sets a parsed option.
Parameters:
namestring parsed Option name
value* Option value
propNamestring dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value
Returns:
ReflectionObject this -
Converts this field to a field descriptor.
Parameters:
toJSONOptionsIToJSONOptions optional JSON conversion options
Returns:
IField Field descriptor -
Converts this instance to its string representation.
Returns:
string Class name[, space, full name] -
Field.d(fieldId, fieldType, fieldRule, defaultValue){ FieldDecorator }
-
Field decorator (TypeScript).
Parameters:
fieldIdnumber Field id
fieldType"double" | "float" | "int32" | "uint32" | "sint32" | "fixed32" | "sfixed32" | "int64" | "uint64" | "sint64" | "fixed64" | "sfixed64" | "string" | "bool" | "bytes" | Object Field type
fieldRule"optional" | "required" | "repeated" "optional" optional Field rule
defaultValueT optional Default value
Deprecated:
Returns:
FieldDecorator Decorator function -
Field.d(2)(fieldId, fieldType, fieldRule){ FieldDecorator }
-
Field decorator (TypeScript).
Parameters:
fieldIdnumber Field id
fieldTypeConstructor.<T> | string Field type
fieldRule"optional" | "required" | "repeated" "optional" optional Field rule
Deprecated:
Returns:
FieldDecorator Decorator function -
Constructs a field from a field descriptor.
Parameters:
namestring Field name
jsonIField Field descriptor
Throws:
TypeError If arguments are invalid
Returns:
Field Created field