public static final class Descriptors.EnumDescriptor extends Descriptors.GenericDescriptor implements Internal.EnumLiteMap<Descriptors.EnumValueDescriptor>
Describes an enum type.
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 | |
---|---|
Name | Description |
name |
String The unqualified name of the value (e.g. "FOO"). |
Returns | |
---|---|
Type | Description |
Descriptors.EnumValueDescriptor |
the value's descriptor, or |
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 | |
---|---|
Name | Description |
number |
int The value's number. |
Returns | |
---|---|
Type | Description |
Descriptors.EnumValueDescriptor |
the value's descriptor, or |
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 | |
---|---|
Name | Description |
number |
int |
Returns | |
---|---|
Type | Description |
Descriptors.EnumValueDescriptor |
getContainingType()
public Descriptors.Descriptor getContainingType()
If this is a nested type, get the outer descriptor, otherwise null.
Returns | |
---|---|
Type | Description |
Descriptors.Descriptor |
getFile()
public Descriptors.FileDescriptor getFile()
Get the FileDescriptor containing this descriptor.
Returns | |
---|---|
Type | Description |
Descriptors.FileDescriptor |
getFullName()
public String getFullName()
Get the type's fully-qualified name. See Also: Descriptors.Descriptor#getFullName()
Returns | |
---|---|
Type | Description |
String |
getIndex()
public int getIndex()
Get the index of this descriptor within its parent. See Also: Descriptors.Descriptor#getIndex()
Returns | |
---|---|
Type | Description |
int |
getName()
public String getName()
Get the type's unqualified name.
Returns | |
---|---|
Type | Description |
String |
getOptions()
public DescriptorProtos.EnumOptions getOptions()
Get the EnumOptions
, defined in descriptor.proto
.
Returns | |
---|---|
Type | Description |
DescriptorProtos.EnumOptions |
getValues()
public List<Descriptors.EnumValueDescriptor> getValues()
Get a list of defined values for this enum.
Returns | |
---|---|
Type | Description |
List<EnumValueDescriptor> |
toProto()
public DescriptorProtos.EnumDescriptorProto toProto()
Convert the descriptor to its protocol message representation.
Returns | |
---|---|
Type | Description |
DescriptorProtos.EnumDescriptorProto |