R representation of message type field descriptor. This is a thin wrapper around the C++ class FieldDescriptor
1.1
class
Objects from the Class
Objects typically are retrieved from FieldDescriptor
Slots
pointer:: external pointer to the FieldDescriptor c++ object
name:: name of the field within the message type
full_name:: Fully qualified name of the field
type:: Fully qualified name of the type that contains this field
Methods
show: signature(object = "FieldDescriptor"): small description
as.character: signature(x = "FieldDescriptor"): returns the debug string of the field descriptor. This is retrieved by a call to the DebugString
method of the FieldDescriptor object.
toString: signature(x = "FieldDescriptor"): same as as.character
$: signature(x = "FieldDescriptor"): used to invoke pseudo methods
containing_type: signature(object = "FieldDescriptor") : returns a Descriptor of the message type that contains this field descriptor.
is_extension: signature(object = "FieldDescriptor") : indicates if this is an extension.
number: signature(object = "FieldDescriptor") : gets the declared tag number of this field.
type: signature(object = "FieldDescriptor") : type of this field.
cpp_type: signature(object = "FieldDescriptor") : c++ type of this field.
label: signature(object = "FieldDescriptor") : label of this field.
is_required: signature(object = "FieldDescriptor") : is this field required.
is_optional: signature(object = "FieldDescriptor") : is this field optional.
is_repeated: signature(object = "FieldDescriptor") : is this field repeated.
has_default_value: signature(object = "FieldDescriptor") : indicates if this field has a default value.
default_value: signature(object = "FieldDescriptor") : the default value of this field.
message_type: signature(object = "FieldDescriptor") : the Descriptor for the associated message type. Generates an error if this field is not a message type field.
enum_type: signature(object = "FieldDescriptor") : the EnumDescriptor for the associated enum type.Generates an error if this field is not an enum type field
## Not run:# example proto file supplied with this packageproto.file <- system.file("proto","addressbook.proto", package ="RProtoBuf")# reading a proto file and creating the descriptorPerson <- P("tutorial.Person", file = proto.file )## End(Not run)# field descriptor objectPerson$email
# debug stringas.character( Person$email )# or as a pseudo methodPerson$email$as.character()Person$email$is_required()Person$email$is_optional()Person$email$is_repeated()Person$email$has_default_value()Person$email$default_value()Person$email$is_extension()# Get the default valueshas_default_value(Person$id)has_default_value(Person$email)has_default_value(Person$phone)default_value(Person$id)default_value(Person$email)default_value(Person$phone)# Get the types of field descriptorstype(Person$id)type(Person$id, as.string=TRUE)cpp_type(Person$email)cpp_type(Person$email,TRUE)# Get the label of a field descriptorlabel(Person$id)label(Person$email)label(Person$phone)label(Person$id,TRUE)label(Person$email,TRUE)label(Person$phone,TRUE)LABEL_OPTIONAL
LABEL_REQUIRED
LABEL_REPEATED
# Test if a field is optionalis_optional(Person$id)is_optional(Person$email)is_optional(Person$phone)# Test if a field is repeatedis_repeated(Person$id)is_repeated(Person$email)is_repeated(Person$phone)# Test if a field is requiredis_required(Person$id)is_required(Person$email)is_required(Person$phone)# Return the class of a message fieldmessage_type(Person$phone)