Package com.google.protobuf
Class Descriptors.EnumDescriptor
java.lang.Object
com.google.protobuf.Descriptors.GenericDescriptor
com.google.protobuf.Descriptors.EnumDescriptor
- All Implemented Interfaces:
Internal.EnumLiteMap<Descriptors.EnumValueDescriptor>
- Enclosing class:
- Descriptors
public static final class Descriptors.EnumDescriptor
extends Descriptors.GenericDescriptor
implements Internal.EnumLiteMap<Descriptors.EnumValueDescriptor>
Describes an enum type.
-
Method Summary
Modifier and TypeMethodDescriptionfindValueByName(String name) Find an enum value by name.findValueByNumber(int number) Find an enum value by number.If this is a nested type, get the outer descriptor, otherwise null.getFile()Get theDescriptors.FileDescriptorcontaining this descriptor.Get the type's fully-qualified name.intgetIndex()Get the index of this descriptor within its parent.getName()Get the type's unqualified name.Get theEnumOptions, defined indescriptor.proto.Get a list of defined values for this enum.toProto()Convert the descriptor to its protocol message representation.
-
Method Details
-
getIndex
public int getIndex()Get the index of this descriptor within its parent.- See Also:
-
toProto
Convert the descriptor to its protocol message representation.- Specified by:
toProtoin classDescriptors.GenericDescriptor
-
getName
Get the type's unqualified name.- Specified by:
getNamein classDescriptors.GenericDescriptor
-
getFullName
Get the type's fully-qualified name.- Specified by:
getFullNamein classDescriptors.GenericDescriptor- See Also:
-
getFile
Get theDescriptors.FileDescriptorcontaining this descriptor.- Specified by:
getFilein classDescriptors.GenericDescriptor
-
getContainingType
If this is a nested type, get the outer descriptor, otherwise null. -
getOptions
Get theEnumOptions, defined indescriptor.proto. -
getValues
Get a list of defined values for this enum. -
findValueByName
Find an enum value by name.- Parameters:
name- The unqualified name of the value (e.g. "FOO").- Returns:
- the value's descriptor, or
nullif not found.
-
findValueByNumber
Find an enum value by number. If multiple enum values have the same number, this returns the first defined value with that number.- Specified by:
findValueByNumberin interfaceInternal.EnumLiteMap<Descriptors.EnumValueDescriptor>- Parameters:
number- The value's number.- Returns:
- the value's descriptor, or
nullif not found.
-