Constructs a new oneof instance.
| Name | Type | Description |
|---|---|---|
name |
string |
Oneof name |
fieldNames |
Array.<string> | Object.<string, *> |
optional
Field names |
options |
Object.<string, *> |
optional
Declared options |
comment |
string |
optional
Comment associated with this field |
Extends
Members
-
comment { string | null }
-
Comment for this field.
-
fieldsArray readonly{ Field[] }
-
Fields that belong to this oneof as an array for iteration.
-
filename { string | null }
-
Defining file name.
-
fullName readonly{ string }
-
Full name including leading dot.
-
isProto3Optional readonly{ boolean }
-
Determines whether this field corresponds to a synthetic oneof created for
a proto3 optional field. No behavioral logic should depend on this, but it
can be relevant for reflection. -
name { string }
-
Unique name within its namespace.
-
oneof { string[] }
-
Field names that belong to this oneof.
-
options { Object<string, *> | undefined }
-
Options.
-
parent { Namespace | null }
-
Parent namespace.
-
parsedOptions { Object<string, *>[] | undefined }
-
Parsed Options.
-
resolved { boolean }
-
Whether already resolved or not.
-
root readonly{ Root }
-
Reference to the root namespace.
Methods
-
Adds a field to this oneof and removes it from its current parent, if any.
Name Type Description fieldField Field to add
Returns:
Type Description OneOf this -
Gets an option value.
Name Type Description namestring Option name
Returns:
Type Description * Option value or undefinedif not set -
Called when this object is added to a parent.
Name Type Description parentReflectionObject Parent added to
Returns:
Type Description undefined -
Called when this object is removed from a parent.
Name Type Description parentReflectionObject Parent removed from
Returns:
Type Description undefined -
Removes a field from this oneof and puts it back to the oneof's parent.
Name Type Description fieldField Field to remove
Returns:
Type Description OneOf this -
inherited resolve(){ ReflectionObject }
-
Resolves this objects type references.
Returns:
Type Description ReflectionObject this -
inherited setOption(name, value, ifNotSet){ ReflectionObject }
-
Sets an option.
Name Type Description namestring Option name
value* Option value
ifNotSetboolean | undefined optional Sets the option only if it isn't currently set
Returns:
Type Description ReflectionObject this -
inherited setOptions(options, ifNotSet){ ReflectionObject }
-
Sets multiple options.
Name Type Description optionsObject.<string, *> Options to set
ifNotSetboolean optional Sets an option only if it isn't currently set
Returns:
Type Description ReflectionObject this -
inherited setParsedOption(name, value, propName){ ReflectionObject }
-
Sets a parsed option.
Name Type Description 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:
Type Description ReflectionObject this -
Converts this oneof to a oneof descriptor.
Name Type Description toJSONOptionsIToJSONOptions optional JSON conversion options
Returns:
Type Description IOneOf Oneof descriptor -
Converts this instance to its string representation.
Returns:
Type Description string Class name[, space, full name] -
OneOf.d(fieldNames){ OneOfDecorator }
-
OneOf decorator (TypeScript).
Name Type Description fieldNamesstring repeatable Field names
- Deprecated
- Legacy TypeScript decorator support. Will be removed in a future release.
Returns:
Type Description OneOfDecorator Decorator function -
Constructs a oneof from a oneof descriptor.
Name Type Description namestring Oneof name
jsonIOneOf Oneof descriptor
Throws:
Type Description TypeError If arguments are invalid
Returns:
Type Description OneOf Created oneof