# Class Descriptors.Descriptor (3.19.4)

    public static final class Descriptors.Descriptor extends Descriptors.GenericDescriptor

Describes a message type.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [Descriptors.GenericDescriptor](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor) \> Descriptors.Descriptor

## Inherited Members

[Descriptors.GenericDescriptor.getFile()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_getFile__) [Descriptors.GenericDescriptor.getFullName()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_getFullName__) [Descriptors.GenericDescriptor.getName()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_getName__) [Descriptors.GenericDescriptor.toProto()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_toProto__) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Methods

### findEnumTypeByName(String name)

    public Descriptors.EnumDescriptor findEnumTypeByName(String name)

Finds a nested enum type by name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The unqualified name of the nested type (e.g. "Foo"). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.EnumDescriptor` | The types's descriptor, or `null` if not found. |

### findFieldByName(String name)

    public Descriptors.FieldDescriptor findFieldByName(String name)

Finds a field by name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The unqualified name of the field (e.g. "foo"). For protocol buffer messages that follow \<a href=https://developers.google.com/protocol-buffers/docs/style#message_and_field_names\>Google's guidance on naming this will be a snake case string, such as song_name . |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.FieldDescriptor` | The field's descriptor, or `null` if not found. |

### findFieldByNumber(int number)

    public Descriptors.FieldDescriptor findFieldByNumber(int number)

Finds a field by field number.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `number` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The field number within this message type. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.FieldDescriptor` | The field's descriptor, or `null` if not found. |

### findNestedTypeByName(String name)

    public Descriptors.Descriptor findNestedTypeByName(String name)

Finds a nested message type by name.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The unqualified name of the nested type (e.g. "Foo"). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.Descriptor` | The types's descriptor, or `null` if not found. |

### getContainingType()

    public Descriptors.Descriptor getContainingType()

If this is a nested type, get the outer descriptor, otherwise null.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.Descriptor` |   |

### getEnumTypes()

    public List<Descriptors.EnumDescriptor> getEnumTypes()

Get a list of enum types nested within this one.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.EnumDescriptor>` |   |

### getExtensions()

    public List<Descriptors.FieldDescriptor> getExtensions()

Get a list of this message type's extensions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.FieldDescriptor>` |   |

### getFields()

    public List<Descriptors.FieldDescriptor> getFields()

Get a list of this message type's fields.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.FieldDescriptor>` |   |

### getFile()

    public Descriptors.FileDescriptor getFile()

Get the FileDescriptor containing this descriptor.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.FileDescriptor` |   |

**Overrides** [Descriptors.GenericDescriptor.getFile()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_getFile__)

### getFullName()

    public 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".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Descriptors.GenericDescriptor.getFullName()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_getFullName__)

### getIndex()

    public int getIndex()

Get the index of this descriptor within its parent. In other words, given a FileDescriptor `file`, the following is true:

for all i in \[0, file.getMessageTypeCount()):
file.getMessageType(i).getIndex() == i

Similarly, for a [Descriptor](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.Descriptor) `messageType`:

for all i in \[0, messageType.getNestedTypeCount()):
messageType.getNestedType(i).getIndex() == i

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getName()

    public String getName()

Get the type's unqualified name.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Descriptors.GenericDescriptor.getName()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_getName__)

### getNestedTypes()

    public List<Descriptors.Descriptor> getNestedTypes()

Get a list of message types nested within this one.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.Descriptor>` |   |

### getOneofs()

    public List<Descriptors.OneofDescriptor> getOneofs()

Get a list of this message type's oneofs.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.OneofDescriptor>` |   |

### getOptions()

    public DescriptorProtos.MessageOptions getOptions()

Get the `MessageOptions`, defined in `descriptor.proto`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.DescriptorProtos.MessageOptions` |   |

### getRealOneofs()

    public List<Descriptors.OneofDescriptor> getRealOneofs()

Get a list of this message type's real oneofs.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.OneofDescriptor>` |   |

### isExtendable()

    public boolean isExtendable()

Indicates whether the message can be extended. That is, whether it has any "extensions x to
y" ranges declared on it.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isExtensionNumber(int number)

    public boolean isExtensionNumber(int number)

Determines if the given field number is an extension.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `number` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isReservedName(String name)

    public boolean isReservedName(String name)

Determines if the given field name is reserved.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### isReservedNumber(int number)

    public boolean isReservedNumber(int number)

Determines if the given field number is reserved.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `number` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### toProto()

    public DescriptorProtos.DescriptorProto toProto()

Convert the descriptor to its protocol message representation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.DescriptorProtos.DescriptorProto` |   |

**Overrides** [Descriptors.GenericDescriptor.toProto()](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.GenericDescriptor#com_google_protobuf_Descriptors_GenericDescriptor_toProto__)