public final class Field extends GeneratedMessageLite<Field,Field.Builder> 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.
|
GeneratedMessageLite.DefaultInstanceBasedParser<T extends GeneratedMessageLite<T,?>>, GeneratedMessageLite.ExtendableBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageLite.ExtendableMessage<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageLite.ExtendableMessageOrBuilder<MessageType extends GeneratedMessageLite.ExtendableMessage<MessageType,BuilderType>,BuilderType extends GeneratedMessageLite.ExtendableBuilder<MessageType,BuilderType>>, GeneratedMessageLite.GeneratedExtension<ContainingType extends MessageLite,Type>, GeneratedMessageLite.MergeFromVisitor, GeneratedMessageLite.MethodToInvoke, GeneratedMessageLite.SerializedForm, GeneratedMessageLite.Visitor
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 |
memoizedSerializedSize, unknownFields
memoizedHashCode
Modifier and Type | Method and Description |
---|---|
protected Object |
dynamicMethod(GeneratedMessageLite.MethodToInvoke method,
Object arg0,
Object arg1)
A method that implements different types of operations described in
GeneratedMessageLite.MethodToInvoke . |
Field.Cardinality |
getCardinality()
The field cardinality.
|
int |
getCardinalityValue()
The field cardinality.
|
static Field |
getDefaultInstance() |
String |
getDefaultValue()
The string value of the default value of this field.
|
ByteString |
getDefaultValueBytes()
The string value of the default value of this field.
|
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.
|
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.
|
static Field.Builder |
newBuilder() |
static Field.Builder |
newBuilder(Field prototype) |
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() |
void |
writeTo(CodedOutputStream output)
Serializes the message and writes it to
output . |
dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, hashCode, isInitialized, isInitialized, makeImmutable, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, toBuilder, toString
addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getDefaultInstanceForType, isInitialized
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 int getKindValue()
The field type.
optional .google.protobuf.Field.Kind kind = 1;
getKindValue
in interface FieldOrBuilder
public Field.Kind getKind()
The field type.
optional .google.protobuf.Field.Kind kind = 1;
getKind
in interface FieldOrBuilder
public int getCardinalityValue()
The field cardinality.
optional .google.protobuf.Field.Cardinality cardinality = 2;
getCardinalityValue
in interface FieldOrBuilder
public Field.Cardinality getCardinality()
The field cardinality.
optional .google.protobuf.Field.Cardinality cardinality = 2;
getCardinality
in interface FieldOrBuilder
public int getNumber()
The field number.
optional int32 number = 3;
getNumber
in interface FieldOrBuilder
public String getName()
The field name.
optional string name = 4;
getName
in interface FieldOrBuilder
public ByteString getNameBytes()
The field name.
optional 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"`.
optional 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"`.
optional 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.
optional int32 oneof_index = 7;
getOneofIndex
in interface FieldOrBuilder
public boolean getPacked()
Whether to use alternative packed wire representation.
optional 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;
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;
public String getJsonName()
The field JSON name.
optional string json_name = 10;
getJsonName
in interface FieldOrBuilder
public ByteString getJsonNameBytes()
The field JSON name.
optional string json_name = 10;
getJsonNameBytes
in interface FieldOrBuilder
public String getDefaultValue()
The string value of the default value of this field. Proto2 syntax only.
optional string default_value = 11;
getDefaultValue
in interface FieldOrBuilder
public ByteString getDefaultValueBytes()
The string value of the default value of this field. Proto2 syntax only.
optional string default_value = 11;
getDefaultValueBytes
in interface FieldOrBuilder
public void writeTo(CodedOutputStream output) throws IOException
MessageLite
output
. This does not
flush or close the stream.writeTo
in interface MessageLite
IOException
public int getSerializedSize()
MessageLite
getSerializedSize
in interface MessageLite
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 static Field.Builder newBuilder()
public static Field.Builder newBuilder(Field prototype)
protected final Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1)
GeneratedMessageLite
GeneratedMessageLite.MethodToInvoke
.
Theses different kinds of operations are required to implement message-level operations for
builders in the runtime. This method bundles those operations to reduce the generated methods
count.
MERGE_FROM_STREAM
is parameterized with an CodedInputStream
and
ExtensionRegistryLite
. It consumes the input stream, parsing the contents into the
returned protocol buffer. If parsing throws an InvalidProtocolBufferException
, the
implementation wraps it in a RuntimeException.
NEW_INSTANCE
returns a new instance of the protocol buffer that has not yet been
made immutable. See MAKE_IMMUTABLE
.
IS_INITIALIZED
is parameterized with a Boolean
detailing whether to
memoize. It returns null
for false and the default instance for true. We optionally
memoize to support the Builder case, where memoization is not desired.
NEW_BUILDER
returns a BuilderType
instance.
VISIT
is parameterized with a Visitor
and a MessageType
and
recursively iterates through the fields side by side between this and the instance.
MAKE_IMMUTABLE
sets all internal fields to an immutable state.
For use by generated code only.
dynamicMethod
in class GeneratedMessageLite<Field,Field.Builder>
public static Field getDefaultInstance()
Copyright © 2008–2016 Google. All rights reserved.