public static final class Descriptors.Descriptor extends Descriptors.GenericDescriptor
| Modifier and Type | Method and Description |
|---|---|
Descriptors |
findEnumTypeByName(String
Finds a nested enum type by name.
|
Descriptors |
findFieldByName(String
Finds a field by name.
|
Descriptors |
findFieldByNumber(int number)
Finds a field by field number.
|
Descriptors |
findNestedTypeByName(String
Finds a nested message type by name.
|
Descriptors |
getContainingType()
If this is a nested type, get the outer descriptor, otherwise null.
|
List |
getEnumTypes()
Get a list of enum types nested within this one.
|
List |
getExtensions()
Get a list of this message type's extensions.
|
List |
getFields()
Get a list of this message type's fields.
|
Descriptors |
getFile()
Get the
Descriptors.FileDescriptor containing this descriptor.
|
String |
getFullName()
Get the type's fully-qualified name, within the proto language's namespace.
|
int |
getIndex()
Get the index of this descriptor within its parent.
|
String |
getName()
Get the type's unqualified name.
|
List |
getNestedTypes()
Get a list of message types nested within this one.
|
List |
getOneofs()
Get a list of this message type's oneofs.
|
DescriptorProtos |
getOptions()
Get the
MessageOptions, defined in
descriptor.proto.
|
boolean |
isExtendable()
Indicates whether the message can be extended.
|
boolean |
isExtensionNumber(int number)
Determines if the given field number is an extension.
|
DescriptorProtos |
toProto()
Convert the descriptor to its protocol message representation.
|
public int getIndex()
Descriptors.FileDescriptor
file, the following is true:
for all i in [0, file.getMessageTypeCount()):
file.getMessageType(i).getIndex() == i
Similarly, for a
Descriptors.Descriptor
messageType:
for all i in [0, messageType.getNestedTypeCount()):
messageType.getNestedType(i).getIndex() == i
public DescriptorProtos.DescriptorProto toProto()
public StringgetName()
public StringgetFullName()
.proto:
package foo.bar;
option java_package = "com.example.protos"
message Baz {}
Baz's full name is "foo.bar.Baz".
public Descriptors.FileDescriptor getFile()
Descriptors.FileDescriptor containing this descriptor.
public Descriptors.Descriptor getContainingType()
public DescriptorProtos.MessageOptions getOptions()
MessageOptions, defined in
descriptor.proto.
public List<Descriptors .FieldDescriptor > getFields()
public List<Descriptors .OneofDescriptor > getOneofs()
public List<Descriptors .FieldDescriptor > getExtensions()
public List<Descriptors .Descriptor > getNestedTypes()
public List<Descriptors .EnumDescriptor > getEnumTypes()
public boolean isExtensionNumber(int number)
public boolean isExtendable()
public Descriptors.FieldDescriptor findFieldByName(String name)
name - The unqualified name of the field (e.g. "foo").
null if not found.
public Descriptors.FieldDescriptor findFieldByNumber(int number)
number - The field number within this message type.
null if not found.
public Descriptors.Descriptor findNestedTypeByName(String name)
name - The unqualified name of the nested type (e.g. "Foo").
null if not found.
public Descriptors.EnumDescriptor findEnumTypeByName(String name)
name - The unqualified name of the nested type (e.g. "Foo").
null if not found.