public static final class Descriptors.Descriptor extends Descriptors.GenericDescriptor
Modifier and Type | Method and Description |
---|---|
Descriptors.EnumDescriptor |
findEnumTypeByName(java.lang.String name)
Finds a nested enum type by name.
|
Descriptors.FieldDescriptor |
findFieldByName(java.lang.String name)
Finds a field by name.
|
Descriptors.FieldDescriptor |
findFieldByNumber(int number)
Finds a field by field number.
|
Descriptors.Descriptor |
findNestedTypeByName(java.lang.String name)
Finds a nested message type by name.
|
Descriptors.Descriptor |
getContainingType()
If this is a nested type, get the outer descriptor, otherwise null.
|
java.util.List<Descriptors.EnumDescriptor> |
getEnumTypes()
Get a list of enum types nested within this one.
|
java.util.List<Descriptors.FieldDescriptor> |
getExtensions()
Get a list of this message type's extensions.
|
java.util.List<Descriptors.FieldDescriptor> |
getFields()
Get a list of this message type's fields.
|
Descriptors.FileDescriptor |
getFile()
Get the
Descriptors.FileDescriptor containing this descriptor. |
java.lang.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.
|
java.lang.String |
getName()
Get the type's unqualified name.
|
java.util.List<Descriptors.Descriptor> |
getNestedTypes()
Get a list of message types nested within this one.
|
java.util.List<Descriptors.OneofDescriptor> |
getOneofs()
Get a list of this message type's oneofs.
|
DescriptorProtos.MessageOptions |
getOptions()
Get the
MessageOptions , defined in descriptor.proto . |
java.util.List<Descriptors.OneofDescriptor> |
getRealOneofs()
Get a list of this message type's real oneofs.
|
boolean |
isExtendable()
Indicates whether the message can be extended.
|
boolean |
isExtensionNumber(int number)
Determines if the given field number is an extension.
|
boolean |
isReservedName(java.lang.String name)
Determines if the given field name is reserved.
|
boolean |
isReservedNumber(int number)
Determines if the given field number is reserved.
|
DescriptorProtos.DescriptorProto |
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() == iSimilarly, for a
Descriptors.Descriptor
messageType
:
for all i in [0, messageType.getNestedTypeCount()): messageType.getNestedType(i).getIndex() == i
public DescriptorProtos.DescriptorProto toProto()
toProto
in class Descriptors.GenericDescriptor
public java.lang.String getName()
getName
in class Descriptors.GenericDescriptor
public java.lang.String getFullName()
.proto
:
package foo.bar; option java_package = "com.example.protos" message Baz {}
Baz
's full name is "foo.bar.Baz".getFullName
in class Descriptors.GenericDescriptor
public Descriptors.FileDescriptor getFile()
Descriptors.FileDescriptor
containing this descriptor.getFile
in class Descriptors.GenericDescriptor
public Descriptors.Descriptor getContainingType()
public DescriptorProtos.MessageOptions getOptions()
MessageOptions
, defined in descriptor.proto
.public java.util.List<Descriptors.FieldDescriptor> getFields()
public java.util.List<Descriptors.OneofDescriptor> getOneofs()
public java.util.List<Descriptors.OneofDescriptor> getRealOneofs()
public java.util.List<Descriptors.FieldDescriptor> getExtensions()
public java.util.List<Descriptors.Descriptor> getNestedTypes()
public java.util.List<Descriptors.EnumDescriptor> getEnumTypes()
public boolean isExtensionNumber(int number)
public boolean isReservedNumber(int number)
public boolean isReservedName(java.lang.String name)
public boolean isExtendable()
public Descriptors.FieldDescriptor findFieldByName(java.lang.String name)
name
- The unqualified name of the field (e.g. "foo"). For protocol buffer messages that
follow Google's
guidance on naming this will be a snake case string, such as song_name.
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(java.lang.String name)
name
- The unqualified name of the nested type (e.g. "Foo").null
if not found.public Descriptors.EnumDescriptor findEnumTypeByName(java.lang.String name)
name
- The unqualified name of the nested type (e.g. "Foo").null
if not found.