public final class Field extends GeneratedMessageV3 implements FieldOrBuilder
A single field of a message type.Protobuf type
google.protobuf.Field
Modifier and Type | Class and Description |
---|---|
static class |
Field.Builder
A single field of a message type.
|
static class |
Field.Cardinality
Whether a field is optional, required, or repeated.
|
static class |
Field.Kind
Basic field types.
|
GeneratedMessageV3.BuilderParent, GeneratedMessageV3.ExtendableBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage,BuilderType extends GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageV3.ExtendableMessage<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageV3.ExtendableMessage>, GeneratedMessageV3.FieldAccessorTable, GeneratedMessageV3.UnusedPrivateParameter
AbstractMessageLite.InternalOneOfEnum
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()
The field cardinality.
|
int |
getCardinalityValue()
The field cardinality.
|
static Field |
getDefaultInstance() |
Field |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
String |
getDefaultValue()
The string value of the default value of this field.
|
ByteString |
getDefaultValueBytes()
The string value of the default value of this field.
|
static Descriptors.Descriptor |
getDescriptor() |
String |
getJsonName()
The field JSON name.
|
ByteString |
getJsonNameBytes()
The field JSON name.
|
Field.Kind |
getKind()
The field type.
|
int |
getKindValue()
The field type.
|
String |
getName()
The field name.
|
ByteString |
getNameBytes()
The field name.
|
int |
getNumber()
The field number.
|
int |
getOneofIndex()
The index of the field type in `Type.oneofs`, for message or enumeration
types.
|
Option |
getOptions(int index)
The protocol buffer options.
|
int |
getOptionsCount()
The protocol buffer options.
|
List<Option> |
getOptionsList()
The protocol buffer options.
|
OptionOrBuilder |
getOptionsOrBuilder(int index)
The protocol buffer options.
|
List<? extends OptionOrBuilder> |
getOptionsOrBuilderList()
The protocol buffer options.
|
boolean |
getPacked()
Whether to use alternative packed wire representation.
|
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()
The field type URL, without the scheme, for message or enumeration
types.
|
ByteString |
getTypeUrlBytes()
The field type URL, without the scheme, for message or enumeration
types.
|
UnknownFieldSet |
getUnknownFields()
Get the
UnknownFieldSet for this message. |
int |
hashCode()
Returns the hash code value for this message.
|
protected GeneratedMessageV3.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(GeneratedMessageV3.BuilderParent parent)
TODO(xiaofeng): remove this together with GeneratedMessageV3.BuilderParent.
|
protected Object |
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Creates a new instance of this message type.
|
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(ByteBuffer data) |
static Field |
parseFrom(ByteBuffer 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 . |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTag
findInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toString
addAll, 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
protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
GeneratedMessageV3
newInstance
in class GeneratedMessageV3
public final UnknownFieldSet getUnknownFields()
MessageOrBuilder
UnknownFieldSet
for this message.getUnknownFields
in interface MessageOrBuilder
getUnknownFields
in class GeneratedMessageV3
public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
GeneratedMessageV3
internalGetFieldAccessorTable
in class GeneratedMessageV3
public int getKindValue()
The field type.
.google.protobuf.Field.Kind kind = 1;
getKindValue
in interface FieldOrBuilder
public Field.Kind getKind()
The field type.
.google.protobuf.Field.Kind kind = 1;
getKind
in interface FieldOrBuilder
public int getCardinalityValue()
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
getCardinalityValue
in interface FieldOrBuilder
public Field.Cardinality getCardinality()
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
getCardinality
in interface FieldOrBuilder
public int getNumber()
The field number.
int32 number = 3;
getNumber
in interface FieldOrBuilder
public String getName()
The field name.
string name = 4;
getName
in interface FieldOrBuilder
public ByteString getNameBytes()
The field name.
string name = 4;
getNameBytes
in interface FieldOrBuilder
public String getTypeUrl()
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
getTypeUrl
in interface FieldOrBuilder
public ByteString getTypeUrlBytes()
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
getTypeUrlBytes
in interface FieldOrBuilder
public int getOneofIndex()
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.
int32 oneof_index = 7;
getOneofIndex
in interface FieldOrBuilder
public boolean getPacked()
Whether to use alternative packed wire representation.
bool packed = 8;
getPacked
in interface FieldOrBuilder
public List<Option> getOptionsList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsList
in interface FieldOrBuilder
public List<? extends OptionOrBuilder> getOptionsOrBuilderList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsOrBuilderList
in interface FieldOrBuilder
public int getOptionsCount()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsCount
in interface FieldOrBuilder
public Option getOptions(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptions
in interface FieldOrBuilder
public OptionOrBuilder getOptionsOrBuilder(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsOrBuilder
in interface FieldOrBuilder
public String getJsonName()
The field JSON name.
string json_name = 10;
getJsonName
in interface FieldOrBuilder
public ByteString getJsonNameBytes()
The field JSON name.
string json_name = 10;
getJsonNameBytes
in interface FieldOrBuilder
public String getDefaultValue()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
getDefaultValue
in interface FieldOrBuilder
public ByteString getDefaultValueBytes()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
getDefaultValueBytes
in interface FieldOrBuilder
public final boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessageV3
public void writeTo(CodedOutputStream output) throws IOException
MessageLite
output
. This does not flush or close the
stream.writeTo
in interface MessageLite
writeTo
in class GeneratedMessageV3
IOException
public int getSerializedSize()
MessageLite
getSerializedSize
in interface MessageLite
getSerializedSize
in class GeneratedMessageV3
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(ByteBuffer data) throws InvalidProtocolBufferException
InvalidProtocolBufferException
public static Field parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
InvalidProtocolBufferException
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(GeneratedMessageV3.BuilderParent parent)
GeneratedMessageV3
newBuilderForType
in class GeneratedMessageV3
public static Field getDefaultInstance()
public Parser<Field> getParserForType()
MessageLite
getParserForType
in interface Message
getParserForType
in interface MessageLite
getParserForType
in class GeneratedMessageV3
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–2022. All rights reserved.