public final class Field extends GeneratedMessage implements FieldOrBuilder
google.protobuf.Field
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 |
DEFAULT_VALUE_FIELD_NUMBER |
static int |
JSON_NAME_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 int |
TYPE_URL_FIELD_NUMBER |
alwaysUseFieldBuilders, unknownFields
memoizedSize
memoizedHashCode
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares the specified object with this message for equality.
|
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.
|
String |
getDefaultValue()
optional string default_value = 11; |
ByteString |
getDefaultValueBytes()
optional string default_value = 11; |
static Descriptors.Descriptor |
getDescriptor() |
String |
getJsonName()
optional string json_name = 10; |
ByteString |
getJsonNameBytes()
optional string json_name = 10; |
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. |
int |
hashCode()
Returns the hash code value 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 . |
computeStringSize, computeStringSizeNoTag, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, makeExtensionsImmutable, newFileScopedGeneratedExtension, newFileScopedGeneratedExtension, newMessageScopedGeneratedExtension, newMessageScopedGeneratedExtension, parseUnknownField, writeReplace, writeString, writeStringNoTag
findInitializationErrors, getInitializationErrorString, 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 static final int JSON_NAME_FIELD_NUMBER
public static final int DEFAULT_VALUE_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 type.
getKindValue
in interface FieldOrBuilder
public Field.Kind getKind()
optional .google.protobuf.Field.Kind kind = 1;
The field type.
getKind
in interface FieldOrBuilder
public int getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
getCardinalityValue
in interface FieldOrBuilder
public Field.Cardinality getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
getCardinality
in interface FieldOrBuilder
public int getNumber()
optional int32 number = 3;
The 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 field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
getTypeUrl
in interface FieldOrBuilder
public ByteString getTypeUrlBytes()
optional string type_url = 6;
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
getTypeUrlBytes
in interface FieldOrBuilder
public int getOneofIndex()
optional int32 oneof_index = 7;
The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list.
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 protocol buffer options.
getOptionsList
in interface FieldOrBuilder
public List<? extends OptionOrBuilder> getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsOrBuilderList
in interface FieldOrBuilder
public int getOptionsCount()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsCount
in interface FieldOrBuilder
public Option getOptions(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptions
in interface FieldOrBuilder
public OptionOrBuilder getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsOrBuilder
in interface FieldOrBuilder
public String getJsonName()
optional string json_name = 10;
The field JSON name.
getJsonName
in interface FieldOrBuilder
public ByteString getJsonNameBytes()
optional string json_name = 10;
The field JSON name.
getJsonNameBytes
in interface FieldOrBuilder
public String getDefaultValue()
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
getDefaultValue
in interface FieldOrBuilder
public ByteString getDefaultValueBytes()
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
getDefaultValueBytes
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 boolean equals(Object obj)
Message
true
if the given object is a message of the same type (as
defined by getDescriptorForType()
) and has identical values for
all of its fields. Subclasses must implement this; inheriting
Object.equals()
is incorrect.equals
in interface Message
equals
in class AbstractMessage
obj
- object to be compared for equality with this messagetrue
if the specified object is equal to this messagepublic int hashCode()
Message
Object.hashCode()
is incorrect.hashCode
in interface Message
hashCode
in class AbstractMessage
Map.hashCode()
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–2016 Google. All rights reserved.