Class: Element

ProtoBuf.Reflect. Element

new Element(type, resolvedType, isMapKey, syntax, name)

Constructs a new Element implementation that checks and converts values for a particular field type, as appropriate.

An Element represents a single value: either the value of a singular field, or a value contained in one entry of a repeated field or map field. This class does not implement these higher-level concepts; it only encapsulates the low-level typechecking and conversion.

Parameters:
Name Type Description
type Object

Resolved data type

resolvedType ProtoBuf.Reflect.T | null

Resolved type, if relevant (e.g. submessage field).

isMapKey boolean

Is this element a Map key? The value will be converted to string form if so.

syntax string

Syntax level of defining message type, e.g., proto2 or proto3.

name string

Name of the field containing this element (for error messages)

Source:

Members

isMapKey :boolean

Element is a map key.

Type:
  • boolean
Source:

name :string

Name of the field containing this element (for error messages)

Type:
  • string
Source:

resolvedType :ProtoBuf.Reflect.T|null

Element type reference to submessage or enum definition, if needed.

Type:
Source:

syntax :string

Syntax level of defining message type, e.g., proto2 or proto3.

Type:
  • string
Source:

type :Object

Element type, as a string (e.g., int32).

Type:
  • Object
Source:

Methods

(static) defaultFieldValue(type) → {*}

Returns the default value for this field in proto3.

Parameters:
Name Type Description
type string | Object

the field type

Source:
Returns:

Default value

Type
*