|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.protobuf.Descriptors.FieldDescriptor
public static final class Descriptors.FieldDescriptor
Describes a field of a message type.
Nested Class Summary | |
---|---|
static class |
Descriptors.FieldDescriptor.JavaType
|
static class |
Descriptors.FieldDescriptor.Type
|
Method Summary | |
---|---|
int |
compareTo(Descriptors.FieldDescriptor other)
Compare with another FieldDescriptor . |
Descriptors.Descriptor |
getContainingType()
Get the field's containing type. |
java.lang.Object |
getDefaultValue()
Returns the field's default value. |
Descriptors.EnumDescriptor |
getEnumType()
For enum fields, gets the field's type. |
Descriptors.Descriptor |
getExtensionScope()
For extensions defined nested within message types, gets the outer type. |
Descriptors.FileDescriptor |
getFile()
Get the FileDescriptor containing this descriptor. |
java.lang.String |
getFullName()
Get the field's fully-qualified name. |
int |
getIndex()
Get the index of this descriptor within its parent. |
Descriptors.FieldDescriptor.JavaType |
getJavaType()
Get the field's java type. |
Descriptors.Descriptor |
getMessageType()
For embedded message and group fields, gets the field's type. |
java.lang.String |
getName()
Get the field's unqualified name. |
int |
getNumber()
Get the field's number. |
DescriptorProtos.FieldOptions |
getOptions()
Get the FieldOptions , defined in descriptor.proto . |
Descriptors.FieldDescriptor.Type |
getType()
Get the field's declared type. |
boolean |
hasDefaultValue()
Returns true if the field had an explicitly-defined default value. |
boolean |
isExtension()
Is this field an extension? |
boolean |
isOptional()
Is this field declared optional? |
boolean |
isRepeated()
Is this field declared repeated? |
boolean |
isRequired()
Is this field declared required? |
DescriptorProtos.FieldDescriptorProto |
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 |
---|
public int getIndex()
Descriptors.Descriptor.getIndex()
public DescriptorProtos.FieldDescriptorProto toProto()
public java.lang.String getName()
public int getNumber()
public java.lang.String getFullName()
Descriptors.Descriptor.getFullName()
public Descriptors.FieldDescriptor.JavaType getJavaType()
FieldDescriptorProto.Type
maps to exactly one Java type.
public Descriptors.FileDescriptor getFile()
FileDescriptor
containing this descriptor.
public Descriptors.FieldDescriptor.Type getType()
public boolean isRequired()
public boolean isOptional()
public boolean isRepeated()
public boolean hasDefaultValue()
public java.lang.Object getDefaultValue()
public DescriptorProtos.FieldOptions getOptions()
FieldOptions
, defined in descriptor.proto
.
public boolean isExtension()
public Descriptors.Descriptor getContainingType()
getExtensionScope()
.
public Descriptors.Descriptor getExtensionScope()
.proto
file:
message Foo { extensions 1000 to max; } extend Foo { optional int32 baz = 1234; } message Bar { extend Foo { optional int32 qux = 4321; } }Both
baz
's and qux
's containing type is Foo
.
However, baz
's extension scope is null
while
qux
's extension scope is Bar
.
public Descriptors.Descriptor getMessageType()
public Descriptors.EnumDescriptor getEnumType()
public int compareTo(Descriptors.FieldDescriptor other)
FieldDescriptor
. This orders fields in
"canonical" order, which simply means ascending order by field number.
other
must be a field of the same type -- i.e.
getContainingType()
must return the same Descriptor
for
both fields.
compareTo
in interface java.lang.Comparable<Descriptors.FieldDescriptor>
this
is less than,
equal to, or greater than other
, respectively.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |