Package com.google.protobuf
Class DescriptorProtos.FieldDescriptorProto
java.lang.Object
com.google.protobuf.AbstractMessageLite<MessageType,BuilderType>
com.google.protobuf.GeneratedMessageLite<DescriptorProtos.FieldDescriptorProto,DescriptorProtos.FieldDescriptorProto.Builder>
com.google.protobuf.DescriptorProtos.FieldDescriptorProto
- All Implemented Interfaces:
DescriptorProtos.FieldDescriptorProtoOrBuilder,com.google.protobuf.MessageLite,com.google.protobuf.MessageLiteOrBuilder
- Enclosing class:
- DescriptorProtos
public static final class DescriptorProtos.FieldDescriptorProto
extends com.google.protobuf.GeneratedMessageLite<DescriptorProtos.FieldDescriptorProto,DescriptorProtos.FieldDescriptorProto.Builder>
implements DescriptorProtos.FieldDescriptorProtoOrBuilder
Describes a field within a message.Protobuf type
google.protobuf.FieldDescriptorProto-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDescribes a field within a message.static enumProtobuf enumgoogle.protobuf.FieldDescriptorProto.Labelstatic enumProtobuf enumgoogle.protobuf.FieldDescriptorProto.TypeNested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageLite
com.google.protobuf.GeneratedMessageLite.DefaultInstanceBasedParser<T extends com.google.protobuf.GeneratedMessageLite<T,?>>, com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageLite.ExtendableMessage<MessageType, BuilderType>, BuilderType extends com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<MessageType, BuilderType>>, com.google.protobuf.GeneratedMessageLite.GeneratedExtension<ContainingType extends com.google.protobuf.MessageLite, Type extends Object>, com.google.protobuf.GeneratedMessageLite.MethodToInvoke, com.google.protobuf.GeneratedMessageLite.SerializedForm Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
com.google.protobuf.AbstractMessageLite.InternalOneOfEnum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class com.google.protobuf.GeneratedMessageLite
unknownFieldsFields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode -
Method Summary
Modifier and TypeMethodDescriptionprotected final ObjectdynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) For numeric types, contains the original text representation of the value.com.google.protobuf.ByteStringFor numeric types, contains the original text representation of the value.For extensions, this is the name of the type being extended.com.google.protobuf.ByteStringFor extensions, this is the name of the type being extended.JSON name of this field.com.google.protobuf.ByteStringJSON name of this field.getLabel()optional .google.protobuf.FieldDescriptorProto.Label label = 4 [json_name = "label"];getName()optional string name = 1 [json_name = "name"];com.google.protobuf.ByteStringoptional string name = 1 [json_name = "name"];intoptional int32 number = 3 [json_name = "number"];intIf set, gives the index of a oneof in the containing type's oneof_decl list.optional .google.protobuf.FieldOptions options = 8 [json_name = "options"];booleanIf true, this is a proto3 "optional".getType()If type_name is set, this need not be set.For message and enum types, this is the name of the type.com.google.protobuf.ByteStringFor message and enum types, this is the name of the type.booleanFor numeric types, contains the original text representation of the value.booleanFor extensions, this is the name of the type being extended.booleanJSON name of this field.booleanhasLabel()optional .google.protobuf.FieldDescriptorProto.Label label = 4 [json_name = "label"];booleanhasName()optional string name = 1 [json_name = "name"];booleanoptional int32 number = 3 [json_name = "number"];booleanIf set, gives the index of a oneof in the containing type's oneof_decl list.booleanoptional .google.protobuf.FieldOptions options = 8 [json_name = "options"];booleanIf true, this is a proto3 "optional".booleanhasType()If type_name is set, this need not be set.booleanFor message and enum types, this is the name of the type.newBuilder(DescriptorProtos.FieldDescriptorProto prototype) parseDelimitedFrom(InputStream input) parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) parseFrom(byte[] data) parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) parseFrom(com.google.protobuf.ByteString data) parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) parseFrom(com.google.protobuf.CodedInputStream input) parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) parseFrom(InputStream input) parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) parseFrom(ByteBuffer data) parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) static com.google.protobuf.Parser<DescriptorProtos.FieldDescriptorProto>parser()Methods inherited from class com.google.protobuf.GeneratedMessageLite
createBuilder, createBuilder, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, getSerializedSize, hashCode, isInitialized, isInitialized, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newMessageInfo, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, registerDefaultInstance, toBuilder, toString, writeToMethods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Field Details
-
NAME_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER- See Also:
-
NUMBER_FIELD_NUMBER
public static final int NUMBER_FIELD_NUMBER- See Also:
-
LABEL_FIELD_NUMBER
public static final int LABEL_FIELD_NUMBER- See Also:
-
TYPE_FIELD_NUMBER
public static final int TYPE_FIELD_NUMBER- See Also:
-
TYPE_NAME_FIELD_NUMBER
public static final int TYPE_NAME_FIELD_NUMBER- See Also:
-
EXTENDEE_FIELD_NUMBER
public static final int EXTENDEE_FIELD_NUMBER- See Also:
-
DEFAULT_VALUE_FIELD_NUMBER
public static final int DEFAULT_VALUE_FIELD_NUMBER- See Also:
-
ONEOF_INDEX_FIELD_NUMBER
public static final int ONEOF_INDEX_FIELD_NUMBER- See Also:
-
JSON_NAME_FIELD_NUMBER
public static final int JSON_NAME_FIELD_NUMBER- See Also:
-
OPTIONS_FIELD_NUMBER
public static final int OPTIONS_FIELD_NUMBER- See Also:
-
PROTO3_OPTIONAL_FIELD_NUMBER
public static final int PROTO3_OPTIONAL_FIELD_NUMBER- See Also:
-
-
Method Details
-
hasName
public boolean hasName()optional string name = 1 [json_name = "name"];- Specified by:
hasNamein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the name field is set.
-
getName
optional string name = 1 [json_name = "name"];- Specified by:
getNamein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The name.
-
getNameBytes
public com.google.protobuf.ByteString getNameBytes()optional string name = 1 [json_name = "name"];- Specified by:
getNameBytesin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The bytes for name.
-
hasNumber
public boolean hasNumber()optional int32 number = 3 [json_name = "number"];- Specified by:
hasNumberin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the number field is set.
-
getNumber
public int getNumber()optional int32 number = 3 [json_name = "number"];- Specified by:
getNumberin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The number.
-
hasLabel
public boolean hasLabel()optional .google.protobuf.FieldDescriptorProto.Label label = 4 [json_name = "label"];- Specified by:
hasLabelin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the label field is set.
-
getLabel
optional .google.protobuf.FieldDescriptorProto.Label label = 4 [json_name = "label"];- Specified by:
getLabelin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The label.
-
hasType
public boolean hasType()If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
optional .google.protobuf.FieldDescriptorProto.Type type = 5 [json_name = "type"];- Specified by:
hasTypein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the type field is set.
-
getType
If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
optional .google.protobuf.FieldDescriptorProto.Type type = 5 [json_name = "type"];- Specified by:
getTypein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The type.
-
hasTypeName
public boolean hasTypeName()For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).
optional string type_name = 6 [json_name = "typeName"];- Specified by:
hasTypeNamein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the typeName field is set.
-
getTypeName
For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).
optional string type_name = 6 [json_name = "typeName"];- Specified by:
getTypeNamein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The typeName.
-
getTypeNameBytes
public com.google.protobuf.ByteString getTypeNameBytes()For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).
optional string type_name = 6 [json_name = "typeName"];- Specified by:
getTypeNameBytesin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The bytes for typeName.
-
hasExtendee
public boolean hasExtendee()For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.
optional string extendee = 2 [json_name = "extendee"];- Specified by:
hasExtendeein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the extendee field is set.
-
getExtendee
For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.
optional string extendee = 2 [json_name = "extendee"];- Specified by:
getExtendeein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The extendee.
-
getExtendeeBytes
public com.google.protobuf.ByteString getExtendeeBytes()For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.
optional string extendee = 2 [json_name = "extendee"];- Specified by:
getExtendeeBytesin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The bytes for extendee.
-
hasDefaultValue
public boolean hasDefaultValue()For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped.
optional string default_value = 7 [json_name = "defaultValue"];- Specified by:
hasDefaultValuein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the defaultValue field is set.
-
getDefaultValue
For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped.
optional string default_value = 7 [json_name = "defaultValue"];- Specified by:
getDefaultValuein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The defaultValue.
-
getDefaultValueBytes
public com.google.protobuf.ByteString getDefaultValueBytes()For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped.
optional string default_value = 7 [json_name = "defaultValue"];- Specified by:
getDefaultValueBytesin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The bytes for defaultValue.
-
hasOneofIndex
public boolean hasOneofIndex()If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof.
optional int32 oneof_index = 9 [json_name = "oneofIndex"];- Specified by:
hasOneofIndexin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the oneofIndex field is set.
-
getOneofIndex
public int getOneofIndex()If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof.
optional int32 oneof_index = 9 [json_name = "oneofIndex"];- Specified by:
getOneofIndexin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The oneofIndex.
-
hasJsonName
public boolean hasJsonName()JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.
optional string json_name = 10 [json_name = "jsonName"];- Specified by:
hasJsonNamein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the jsonName field is set.
-
getJsonName
JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.
optional string json_name = 10 [json_name = "jsonName"];- Specified by:
getJsonNamein interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The jsonName.
-
getJsonNameBytes
public com.google.protobuf.ByteString getJsonNameBytes()JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.
optional string json_name = 10 [json_name = "jsonName"];- Specified by:
getJsonNameBytesin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The bytes for jsonName.
-
hasOptions
public boolean hasOptions()optional .google.protobuf.FieldOptions options = 8 [json_name = "options"];- Specified by:
hasOptionsin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the options field is set.
-
getOptions
optional .google.protobuf.FieldOptions options = 8 [json_name = "options"];- Specified by:
getOptionsin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The options.
-
hasProto3Optional
public boolean hasProto3Optional()If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with `LABEL_OPTIONAL`.
optional bool proto3_optional = 17 [json_name = "proto3Optional"];- Specified by:
hasProto3Optionalin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- Whether the proto3Optional field is set.
-
getProto3Optional
public boolean getProto3Optional()If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with `LABEL_OPTIONAL`.
optional bool proto3_optional = 17 [json_name = "proto3Optional"];- Specified by:
getProto3Optionalin interfaceDescriptorProtos.FieldDescriptorProtoOrBuilder- Returns:
- The proto3Optional.
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
public static DescriptorProtos.FieldDescriptorProto parseDelimitedFrom(InputStream input) throws IOException - Throws:
IOException
-
parseDelimitedFrom
public static DescriptorProtos.FieldDescriptorProto parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(com.google.protobuf.CodedInputStream input) throws IOException - Throws:
IOException
-
parseFrom
public static DescriptorProtos.FieldDescriptorProto parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilder
-
newBuilder
public static DescriptorProtos.FieldDescriptorProto.Builder newBuilder(DescriptorProtos.FieldDescriptorProto prototype) -
dynamicMethod
protected final Object dynamicMethod(com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) - Specified by:
dynamicMethodin classcom.google.protobuf.GeneratedMessageLite<DescriptorProtos.FieldDescriptorProto,DescriptorProtos.FieldDescriptorProto.Builder>
-
getDefaultInstance
-
parser
-