com.google.protobuf
Class Descriptors.Descriptor

java.lang.Object
  extended by com.google.protobuf.Descriptors.Descriptor
Enclosing class:
Descriptors

public static final class Descriptors.Descriptor
extends java.lang.Object

Describes a message type.


Method Summary
 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.
 com.google.protobuf.DescriptorProtos.MessageOptions getOptions()
          Get the MessageOptions, defined in descriptor.proto.
 boolean isExtensionNumber(int number)
          Determines if the given field number is an extension.
 com.google.protobuf.DescriptorProtos.DescriptorProto toProto()
          Convert the descriptor to its protocol message representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getIndex

public int getIndex()
Get the index of this descriptor within its parent. In other words, given a Descriptors.FileDescriptor file, the following is true:
   for all i in [0, file.getMessageTypeCount()):
     file.getMessageType(i).getIndex() == i
 
Similarly, for a Descriptors.FileDescriptor messageType:
   for all i in [0, messageType.getNestedTypeCount()):
     messageType.getNestedType(i).getIndex() == i
 


toProto

public com.google.protobuf.DescriptorProtos.DescriptorProto toProto()
Convert the descriptor to its protocol message representation.


getName

public java.lang.String getName()
Get the type's unqualified name.


getFullName

public java.lang.String getFullName()
Get the type's fully-qualified name, within the proto language's namespace. This differs from the Java name. For example, given this .proto:
   package foo.bar;
   option java_package = "com.example.protos"
   message Baz {}
 
Baz's full name is "foo.bar.Baz".


getFile

public Descriptors.FileDescriptor getFile()
Get the Descriptors.FileDescriptor containing this descriptor.


getContainingType

public Descriptors.Descriptor getContainingType()
If this is a nested type, get the outer descriptor, otherwise null.


getOptions

public com.google.protobuf.DescriptorProtos.MessageOptions getOptions()
Get the MessageOptions, defined in descriptor.proto.


getFields

public java.util.List<Descriptors.FieldDescriptor> getFields()
Get a list of this message type's fields.


getExtensions

public java.util.List<Descriptors.FieldDescriptor> getExtensions()
Get a list of this message type's extensions.


getNestedTypes

public java.util.List<Descriptors.Descriptor> getNestedTypes()
Get a list of message types nested within this one.


getEnumTypes

public java.util.List<Descriptors.EnumDescriptor> getEnumTypes()
Get a list of enum types nested within this one.


isExtensionNumber

public boolean isExtensionNumber(int number)
Determines if the given field number is an extension.


findFieldByName

public Descriptors.FieldDescriptor findFieldByName(java.lang.String name)
Finds a field by name.

Parameters:
name - The unqualified name of the field (e.g. "foo").
Returns:
The field's descriptor, or null if not found.

findFieldByNumber

public Descriptors.FieldDescriptor findFieldByNumber(int number)
Finds a field by field number.

Parameters:
number - The field number within this message type.
Returns:
The field's descriptor, or null if not found.

findNestedTypeByName

public Descriptors.Descriptor findNestedTypeByName(java.lang.String name)
Finds a nested message type by name.

Parameters:
name - The unqualified name of the nested type (e.g. "Foo").
Returns:
The types's descriptor, or null if not found.

findEnumTypeByName

public Descriptors.EnumDescriptor findEnumTypeByName(java.lang.String name)
Finds a nested enum type by name.

Parameters:
name - The unqualified name of the nested type (e.g. "Foo").
Returns:
The types's descriptor, or null if not found.


Copyright © 2008-2011 Google. All Rights Reserved.