public static final class Field.Builder extends GeneratedMessage.Builder<Field.Builder> implements FieldOrBuilder
google.protobuf.Field
Field represents a single field of a message type.
Modifier and Type | Method and Description |
---|---|
Field.Builder |
addAllOptions(Iterable<? extends Option> values)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(int index,
Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(int index,
Option value)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(Option value)
repeated .google.protobuf.Option options = 9; |
Option.Builder |
addOptionsBuilder()
repeated .google.protobuf.Option options = 9; |
Option.Builder |
addOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9; |
Field |
build()
Constructs the message based on the state of the Builder.
|
Field |
buildPartial()
Like
MessageLite.Builder.build() , but does not throw an exception if the message
is missing required fields. |
Field.Builder |
clear()
Called by the initialization and clear code paths to allow subclasses to
reset any of their builtin fields back to the initial values.
|
Field.Builder |
clearCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field.Builder |
clearKind()
optional .google.protobuf.Field.Kind kind = 1; |
Field.Builder |
clearName()
optional string name = 4; |
Field.Builder |
clearNumber()
optional int32 number = 3; |
Field.Builder |
clearOneofIndex()
optional int32 oneof_index = 7; |
Field.Builder |
clearOptions()
repeated .google.protobuf.Option options = 9; |
Field.Builder |
clearPacked()
optional bool packed = 8; |
Field.Builder |
clearTypeUrl()
optional string type_url = 6; |
Field.Cardinality |
getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
int |
getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
static Descriptors.Descriptor |
getDescriptor() |
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor.
|
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; |
Option.Builder |
getOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9; |
List<Option.Builder> |
getOptionsBuilderList()
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; |
String |
getTypeUrl()
optional string type_url = 6; |
ByteString |
getTypeUrlBytes()
optional string type_url = 6; |
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.
|
Field.Builder |
mergeFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry)
Like
MessageLite.Builder.mergeFrom(CodedInputStream) , but also
parses extensions. |
Field.Builder |
mergeFrom(Field other) |
Field.Builder |
mergeFrom(Message other)
Merge
other into the message being built. |
Field.Builder |
mergeUnknownFields(UnknownFieldSet unknownFields)
Merge some unknown fields into the
UnknownFieldSet for this
message. |
Field.Builder |
removeOptions(int index)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
setCardinality(Field.Cardinality value)
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field.Builder |
setCardinalityValue(int value)
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field.Builder |
setKind(Field.Kind value)
optional .google.protobuf.Field.Kind kind = 1; |
Field.Builder |
setKindValue(int value)
optional .google.protobuf.Field.Kind kind = 1; |
Field.Builder |
setName(String value)
optional string name = 4; |
Field.Builder |
setNameBytes(ByteString value)
optional string name = 4; |
Field.Builder |
setNumber(int value)
optional int32 number = 3; |
Field.Builder |
setOneofIndex(int value)
optional int32 oneof_index = 7; |
Field.Builder |
setOptions(int index,
Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
setOptions(int index,
Option value)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
setPacked(boolean value)
optional bool packed = 8; |
Field.Builder |
setTypeUrl(String value)
optional string type_url = 6; |
Field.Builder |
setTypeUrlBytes(ByteString value)
optional string type_url = 6; |
Field.Builder |
setUnknownFields(UnknownFieldSet unknownFields)
Set the
UnknownFieldSet for this message. |
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField
findInitializationErrors, getInitializationErrorString, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
addAll, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
GeneratedMessage.Builder
internalGetFieldAccessorTable
in class GeneratedMessage.Builder<Field.Builder>
public Field.Builder clear()
GeneratedMessage.Builder
clear
in interface Message.Builder
clear
in interface MessageLite.Builder
clear
in class GeneratedMessage.Builder<Field.Builder>
public Descriptors.Descriptor getDescriptorForType()
Message.Builder
MessageOrBuilder.getDescriptorForType()
.getDescriptorForType
in interface Message.Builder
getDescriptorForType
in interface MessageOrBuilder
getDescriptorForType
in class GeneratedMessage.Builder<Field.Builder>
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
public Field build()
MessageLite.Builder
build
in interface Message.Builder
build
in interface MessageLite.Builder
public Field buildPartial()
MessageLite.Builder
MessageLite.Builder.build()
, but does not throw an exception if the message
is missing required fields. Instead, a partial message is returned.
Subsequent changes to the Builder will not affect the returned message.buildPartial
in interface Message.Builder
buildPartial
in interface MessageLite.Builder
public Field.Builder mergeFrom(Message other)
Message.Builder
other
into the message being built. other
must
have the exact same type as this
(i.e.
getDescriptorForType() == other.getDescriptorForType()
).
Merging occurs as follows. For each field:other
,
then other
's value overwrites the value in this message.other
,
it is merged into the corresponding sub-message of this message
using the same merging rules.other
are concatenated
with the elements in this message.
This is equivalent to the Message::MergeFrom
method in C++.mergeFrom
in interface Message.Builder
mergeFrom
in class AbstractMessage.Builder<Field.Builder>
public Field.Builder mergeFrom(Field other)
public final boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessage.Builder<Field.Builder>
public Field.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
MessageLite.Builder
MessageLite.Builder.mergeFrom(CodedInputStream)
, but also
parses extensions. The extensions that you want to be able to parse
must be registered in extensionRegistry
. Extensions not in
the registry will be treated as unknown fields.mergeFrom
in interface Message.Builder
mergeFrom
in interface MessageLite.Builder
mergeFrom
in class AbstractMessage.Builder<Field.Builder>
IOException
public int getKindValue()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
getKindValue
in interface FieldOrBuilder
public Field.Builder setKindValue(int value)
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
public Field.Kind getKind()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
getKind
in interface FieldOrBuilder
public Field.Builder setKind(Field.Kind value)
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
public Field.Builder clearKind()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
public int getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
getCardinalityValue
in interface FieldOrBuilder
public Field.Builder setCardinalityValue(int value)
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
public Field.Cardinality getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
getCardinality
in interface FieldOrBuilder
public Field.Builder setCardinality(Field.Cardinality value)
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
public Field.Builder clearCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
public int getNumber()
optional int32 number = 3;
The proto field number.
getNumber
in interface FieldOrBuilder
public Field.Builder setNumber(int value)
optional int32 number = 3;
The proto field number.
public Field.Builder clearNumber()
optional int32 number = 3;
The proto field number.
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 Field.Builder setName(String value)
optional string name = 4;
The field name.
public Field.Builder clearName()
optional string name = 4;
The field name.
public Field.Builder setNameBytes(ByteString value)
optional string name = 4;
The field name.
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 Field.Builder setTypeUrl(String value)
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`.
public Field.Builder clearTypeUrl()
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`.
public Field.Builder setTypeUrlBytes(ByteString value)
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`.
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 Field.Builder setOneofIndex(int value)
optional int32 oneof_index = 7;
Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
public Field.Builder clearOneofIndex()
optional int32 oneof_index = 7;
Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
public boolean getPacked()
optional bool packed = 8;
Whether to use alternative packed wire representation.
getPacked
in interface FieldOrBuilder
public Field.Builder setPacked(boolean value)
optional bool packed = 8;
Whether to use alternative packed wire representation.
public Field.Builder clearPacked()
optional bool packed = 8;
Whether to use alternative packed wire representation.
public List<Option> getOptionsList()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsList
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 Field.Builder setOptions(int index, Option value)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder setOptions(int index, Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(Option value)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(int index, Option value)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(int index, Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addAllOptions(Iterable<? extends Option> values)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder clearOptions()
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder removeOptions(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
public Option.Builder getOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
public OptionOrBuilder getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsOrBuilder
in interface FieldOrBuilder
public List<? extends OptionOrBuilder> getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsOrBuilderList
in interface FieldOrBuilder
public Option.Builder addOptionsBuilder()
repeated .google.protobuf.Option options = 9;
The proto options.
public Option.Builder addOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
public List<Option.Builder> getOptionsBuilderList()
repeated .google.protobuf.Option options = 9;
The proto options.
public final Field.Builder setUnknownFields(UnknownFieldSet unknownFields)
Message.Builder
UnknownFieldSet
for this message.setUnknownFields
in interface Message.Builder
setUnknownFields
in class GeneratedMessage.Builder<Field.Builder>
public final Field.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Message.Builder
UnknownFieldSet
for this
message.mergeUnknownFields
in interface Message.Builder
mergeUnknownFields
in class GeneratedMessage.Builder<Field.Builder>
Copyright © 2008–2015 Google. All rights reserved.