Class Descriptors.EnumDescriptor (3.19.4)

public static final class Descriptors.EnumDescriptor extends Descriptors.GenericDescriptor implements Internal.EnumLiteMap<Descriptors.EnumValueDescriptor>

Describes an enum type.

Inheritance

java.lang.Object > Descriptors.GenericDescriptor > Descriptors.EnumDescriptor

Implements

com.google.protobuf.Internal.EnumLiteMap<com.google.protobuf.Descriptors.EnumValueDescriptor>

Methods

findValueByName(String name)

public Descriptors.EnumValueDescriptor findValueByName(String name)

Find an enum value by name.

Parameter
NameDescription
nameString

The unqualified name of the value (e.g. "FOO").

Returns
TypeDescription
Descriptors.EnumValueDescriptor

the value's descriptor, or null if not found.

findValueByNumber(int number)

public Descriptors.EnumValueDescriptor findValueByNumber(int number)

Find an enum value by number. If multiple enum values have the same number, this returns the first defined value with that number.

Parameter
NameDescription
numberint

The value's number.

Returns
TypeDescription
Descriptors.EnumValueDescriptor

the value's descriptor, or null if not found.

findValueByNumberCreatingIfUnknown(int number)

public Descriptors.EnumValueDescriptor findValueByNumberCreatingIfUnknown(int number)

Get the enum value for a number. If no enum value has this number, construct an EnumValueDescriptor for it.

Parameter
NameDescription
numberint
Returns
TypeDescription
Descriptors.EnumValueDescriptor

getContainingType()

public Descriptors.Descriptor getContainingType()

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

Returns
TypeDescription
Descriptors.Descriptor

getFile()

public Descriptors.FileDescriptor getFile()

Get the FileDescriptor containing this descriptor.

Returns
TypeDescription
Descriptors.FileDescriptor
Overrides

getFullName()

public String getFullName()

Get the type's fully-qualified name. See Also: Descriptors.Descriptor#getFullName()

Returns
TypeDescription
String
Overrides

getIndex()

public int getIndex()

Get the index of this descriptor within its parent. See Also: Descriptors.Descriptor#getIndex()

Returns
TypeDescription
int

getName()

public String getName()

Get the type's unqualified name.

Returns
TypeDescription
String
Overrides

getOptions()

public DescriptorProtos.EnumOptions getOptions()

Get the EnumOptions, defined in descriptor.proto.

Returns
TypeDescription
DescriptorProtos.EnumOptions

getValues()

public List<Descriptors.EnumValueDescriptor> getValues()

Get a list of defined values for this enum.

Returns
TypeDescription
List<EnumValueDescriptor>

toProto()

public DescriptorProtos.EnumDescriptorProto toProto()

Convert the descriptor to its protocol message representation.

Returns
TypeDescription
DescriptorProtos.EnumDescriptorProto
Overrides