public final class Field extends GeneratedMessage implements FieldOrBuilder
google.protobuf.Field
Field represents a single field of a message type.
Modifier and Type | Class and Description |
---|---|
static class |
Field.Builder
Protobuf type
google.protobuf.Field |
static class |
Field.Cardinality
Protobuf enum
google.protobuf.Field.Cardinality |
static class |
Field.Kind
Protobuf enum
google.protobuf.Field.Kind |
GeneratedMessage.BuilderParent, GeneratedMessage.ExtendableBuilder<MessageType extends GeneratedMessage.ExtendableMessage,BuilderType extends GeneratedMessage.ExtendableBuilder>, GeneratedMessage.ExtendableMessage<MessageType extends GeneratedMessage.ExtendableMessage>, GeneratedMessage.ExtendableMessageOrBuilder<MessageType extends GeneratedMessage.ExtendableMessage>, GeneratedMessage.FieldAccessorTable, GeneratedMessage.GeneratedExtension<ContainingType extends Message,Type>
Modifier and Type | Field and Description |
---|---|
static int |
CARDINALITY_FIELD_NUMBER |
static int |
KIND_FIELD_NUMBER |
static int |
NAME_FIELD_NUMBER |
static int |
NUMBER_FIELD_NUMBER |
static int |
ONEOF_INDEX_FIELD_NUMBER |
static int |
OPTIONS_FIELD_NUMBER |
static int |
PACKED_FIELD_NUMBER |
static Parser<Field> |
PARSER |
static int |
TYPE_URL_FIELD_NUMBER |
alwaysUseFieldBuilders, unknownFields
memoizedSize
memoizedHashCode
Modifier and Type | Method and Description |
---|---|
Field.Cardinality |
getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
int |
getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
static Field |
getDefaultInstance() |
Field |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
static Descriptors.Descriptor |
getDescriptor() |
Field.Kind |
getKind()
optional .google.protobuf.Field.Kind kind = 1; |
int |
getKindValue()
optional .google.protobuf.Field.Kind kind = 1; |
String |
getName()
optional string name = 4; |
ByteString |
getNameBytes()
optional string name = 4; |
int |
getNumber()
optional int32 number = 3; |
int |
getOneofIndex()
optional int32 oneof_index = 7; |
Option |
getOptions(int index)
repeated .google.protobuf.Option options = 9; |
int |
getOptionsCount()
repeated .google.protobuf.Option options = 9; |
List<Option> |
getOptionsList()
repeated .google.protobuf.Option options = 9; |
OptionOrBuilder |
getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9; |
List<? extends OptionOrBuilder> |
getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9; |
boolean |
getPacked()
optional bool packed = 8; |
Parser<Field> |
getParserForType()
Gets the parser for a message of the same type as this message.
|
int |
getSerializedSize()
Get the number of bytes required to encode this message.
|
String |
getTypeUrl()
optional string type_url = 6; |
ByteString |
getTypeUrlBytes()
optional string type_url = 6; |
UnknownFieldSet |
getUnknownFields()
Get the
UnknownFieldSet for this message. |
protected GeneratedMessage.FieldAccessorTable |
internalGetFieldAccessorTable()
Get the FieldAccessorTable for this type.
|
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded
messages are set, false otherwise.
|
static Field.Builder |
newBuilder() |
static Field.Builder |
newBuilder(Field prototype) |
Field.Builder |
newBuilderForType()
Constructs a new builder for a message of the same type as this message.
|
protected Field.Builder |
newBuilderForType(GeneratedMessage.BuilderParent parent) |
static Field |
parseDelimitedFrom(InputStream input) |
static Field |
parseDelimitedFrom(InputStream input,
ExtensionRegistryLite extensionRegistry) |
static Field |
parseFrom(byte[] data) |
static Field |
parseFrom(byte[] data,
ExtensionRegistryLite extensionRegistry) |
static Field |
parseFrom(ByteString data) |
static Field |
parseFrom(ByteString data,
ExtensionRegistryLite extensionRegistry) |
static Field |
parseFrom(CodedInputStream input) |
static Field |
parseFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry) |
static Field |
parseFrom(InputStream input) |
static Field |
parseFrom(InputStream input,
ExtensionRegistryLite extensionRegistry) |
static Parser<Field> |
parser() |
Field.Builder |
toBuilder()
Constructs a builder initialized with the current message.
|
void |
writeTo(CodedOutputStream output)
Serializes the message and writes it to
output . |
getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newFileScopedGeneratedExtension, newFileScopedGeneratedExtension, newMessageScopedGeneratedExtension, newMessageScopedGeneratedExtension, parseUnknownField, writeReplace
equals, findInitializationErrors, getInitializationErrorString, hashCode, hashFields, toString
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof
toByteArray, toByteString, writeDelimitedTo, writeTo
public static final int KIND_FIELD_NUMBER
public static final int CARDINALITY_FIELD_NUMBER
public static final int NUMBER_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER
public static final int TYPE_URL_FIELD_NUMBER
public static final int ONEOF_INDEX_FIELD_NUMBER
public static final int PACKED_FIELD_NUMBER
public static final int OPTIONS_FIELD_NUMBER
public final UnknownFieldSet getUnknownFields()
MessageOrBuilder
UnknownFieldSet
for this message.getUnknownFields
in interface MessageOrBuilder
getUnknownFields
in class GeneratedMessage
public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
GeneratedMessage
internalGetFieldAccessorTable
in class GeneratedMessage
public int getKindValue()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
getKindValue
in interface FieldOrBuilder
public Field.Kind getKind()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
getKind
in interface FieldOrBuilder
public int getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
getCardinalityValue
in interface FieldOrBuilder
public Field.Cardinality getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
getCardinality
in interface FieldOrBuilder
public int getNumber()
optional int32 number = 3;
The proto field number.
getNumber
in interface FieldOrBuilder
public String getName()
optional string name = 4;
The field name.
getName
in interface FieldOrBuilder
public ByteString getNameBytes()
optional string name = 4;
The field name.
getNameBytes
in interface FieldOrBuilder
public String getTypeUrl()
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
getTypeUrl
in interface FieldOrBuilder
public ByteString getTypeUrlBytes()
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
getTypeUrlBytes
in interface FieldOrBuilder
public int getOneofIndex()
optional int32 oneof_index = 7;
Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
getOneofIndex
in interface FieldOrBuilder
public boolean getPacked()
optional bool packed = 8;
Whether to use alternative packed wire representation.
getPacked
in interface FieldOrBuilder
public List<Option> getOptionsList()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsList
in interface FieldOrBuilder
public List<? extends OptionOrBuilder> getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsOrBuilderList
in interface FieldOrBuilder
public int getOptionsCount()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsCount
in interface FieldOrBuilder
public Option getOptions(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
getOptions
in interface FieldOrBuilder
public OptionOrBuilder getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsOrBuilder
in interface FieldOrBuilder
public final boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessage
public void writeTo(CodedOutputStream output) throws IOException
MessageLite
output
. This does not
flush or close the stream.writeTo
in interface MessageLite
writeTo
in class GeneratedMessage
IOException
public int getSerializedSize()
MessageLite
getSerializedSize
in interface MessageLite
getSerializedSize
in class GeneratedMessage
public static Field parseFrom(ByteString data) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static Field parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static Field parseFrom(byte[] data) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static Field parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static Field parseFrom(InputStream input) throws IOException
IOException
public static Field parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
IOException
public static Field parseDelimitedFrom(InputStream input) throws IOException
IOException
public static Field parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
IOException
public static Field parseFrom(CodedInputStream input) throws IOException
IOException
public static Field parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
IOException
public Field.Builder newBuilderForType()
MessageLite
newBuilderForType
in interface Message
newBuilderForType
in interface MessageLite
public static Field.Builder newBuilder()
public static Field.Builder newBuilder(Field prototype)
public Field.Builder toBuilder()
MessageLite
toBuilder
in interface Message
toBuilder
in interface MessageLite
protected Field.Builder newBuilderForType(GeneratedMessage.BuilderParent parent)
newBuilderForType
in class GeneratedMessage
public static Field getDefaultInstance()
public Parser<Field> getParserForType()
MessageLite
getParserForType
in interface Message
getParserForType
in interface MessageLite
getParserForType
in class GeneratedMessage
public Field getDefaultInstanceForType()
MessageLiteOrBuilder
getDefaultInstance()
method of generated message classes in that
this method is an abstract method of the MessageLite
interface
whereas getDefaultInstance()
is a static method of a specific
class. They return the same thing.getDefaultInstanceForType
in interface MessageLiteOrBuilder
getDefaultInstanceForType
in interface MessageOrBuilder
Copyright © 2008–2015 Google. All rights reserved.