Package com.google.protobuf
Class Field
- All Implemented Interfaces:
FieldOrBuilder
,MessageLite
,MessageLiteOrBuilder
public final class Field
extends GeneratedMessageLite<Field,Field.Builder>
implements FieldOrBuilder
A single field of a message type.Protobuf type
google.protobuf.Field
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A single field of a message type.static enum
Whether a field is optional, required, or repeated.static enum
Basic field types.Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageLite
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.ExtensionDescriptor, GeneratedMessageLite.GeneratedExtension<ContainingType extends MessageLite, Type>, GeneratedMessageLite.MethodToInvoke, GeneratedMessageLite.SerializedForm Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite
AbstractMessageLite.InternalOneOfEnum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
static final int
private static final Field
static final int
private String
static final int
private String
private int
static final int
private String
static final int
private int
static final int
static final int
private int
private Internal.ProtobufList
<Option> static final int
private boolean
static final int
static final int
private String
Fields inherited from class com.google.protobuf.GeneratedMessageLite
UNINITIALIZED_HASH_CODE, UNINITIALIZED_SERIALIZED_SIZE, unknownFields
Fields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addAllOptions
(Iterable<? extends Option> values) The protocol buffer options.private void
addOptions
(int index, Option value) The protocol buffer options.private void
addOptions
(Option value) The protocol buffer options.private void
The field cardinality.private void
The string value of the default value of this field.private void
The field JSON name.private void
The field type.private void
The field name.private void
The field number.private void
The index of the field type in `Type.oneofs`, for message or enumeration types.private void
The protocol buffer options.private void
Whether to use alternative packed wire representation.private void
The field type URL, without the scheme, for message or enumeration types.protected final Object
dynamicMethod
(GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) A method that implements different types of operations described inGeneratedMessageLite.MethodToInvoke
.private void
The field cardinality.int
The field cardinality.static Field
The string value of the default value of this field.The string value of the default value of this field.The field JSON name.The field JSON name.getKind()
The field type.int
The field type.getName()
The field name.The field name.int
The field number.int
The index of the field type in `Type.oneofs`, for message or enumeration types.getOptions
(int index) The protocol buffer options.int
The protocol buffer options.The protocol buffer options.getOptionsOrBuilder
(int index) The protocol buffer options.List
<? extends OptionOrBuilder> The protocol buffer options.boolean
Whether to use alternative packed wire representation.The field type URL, without the scheme, for message or enumeration types.The field type URL, without the scheme, for message or enumeration types.static Field.Builder
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 Field
parseFrom
(ByteBuffer data) static Field
parseFrom
(ByteBuffer data, ExtensionRegistryLite extensionRegistry) parser()
private void
removeOptions
(int index) The protocol buffer options.private void
setCardinality
(Field.Cardinality value) The field cardinality.private void
setCardinalityValue
(int value) The field cardinality.private void
setDefaultValue
(String value) The string value of the default value of this field.private void
setDefaultValueBytes
(ByteString value) The string value of the default value of this field.private void
setJsonName
(String value) The field JSON name.private void
setJsonNameBytes
(ByteString value) The field JSON name.private void
setKind
(Field.Kind value) The field type.private void
setKindValue
(int value) The field type.private void
The field name.private void
setNameBytes
(ByteString value) The field name.private void
setNumber
(int value) The field number.private void
setOneofIndex
(int value) The index of the field type in `Type.oneofs`, for message or enumeration types.private void
setOptions
(int index, Option value) The protocol buffer options.private void
setPacked
(boolean value) Whether to use alternative packed wire representation.private void
setTypeUrl
(String value) The field type URL, without the scheme, for message or enumeration types.private void
setTypeUrlBytes
(ByteString value) The field type URL, without the scheme, for message or enumeration types.Methods inherited from class com.google.protobuf.GeneratedMessageLite
buildMessageInfo, clearMemoizedHashCode, clearMemoizedSerializedSize, computeHashCode, createBuilder, createBuilder, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstance, getDefaultInstanceForType, getMemoizedHashCode, getMemoizedSerializedSize, getMethodOrDie, getParserForType, getSerializedSize, getSerializedSize, hashCode, hashCodeIsNotMemoized, invokeOrDie, isInitialized, isInitialized, isMutable, makeImmutable, markImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newMessageInfo, newMutableInstance, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parsePartialFrom, parseUnknownField, registerDefaultInstance, setMemoizedHashCode, setMemoizedSerializedSize, toBuilder, toString, writeTo
Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, checkByteStringIsUtf8, newUninitializedMessageException, toByteArray, toByteString, writeDelimitedTo, writeTo
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder
getDefaultInstanceForType, isInitialized
-
Field Details
-
KIND_FIELD_NUMBER
public static final int KIND_FIELD_NUMBER- See Also:
-
kind_
private int kind_ -
CARDINALITY_FIELD_NUMBER
public static final int CARDINALITY_FIELD_NUMBER- See Also:
-
cardinality_
private int cardinality_ -
NUMBER_FIELD_NUMBER
public static final int NUMBER_FIELD_NUMBER- See Also:
-
number_
private int number_ -
NAME_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER- See Also:
-
name_
-
TYPE_URL_FIELD_NUMBER
public static final int TYPE_URL_FIELD_NUMBER- See Also:
-
typeUrl_
-
ONEOF_INDEX_FIELD_NUMBER
public static final int ONEOF_INDEX_FIELD_NUMBER- See Also:
-
oneofIndex_
private int oneofIndex_ -
PACKED_FIELD_NUMBER
public static final int PACKED_FIELD_NUMBER- See Also:
-
packed_
private boolean packed_ -
OPTIONS_FIELD_NUMBER
public static final int OPTIONS_FIELD_NUMBER- See Also:
-
options_
-
JSON_NAME_FIELD_NUMBER
public static final int JSON_NAME_FIELD_NUMBER- See Also:
-
jsonName_
-
DEFAULT_VALUE_FIELD_NUMBER
public static final int DEFAULT_VALUE_FIELD_NUMBER- See Also:
-
defaultValue_
-
DEFAULT_INSTANCE
-
PARSER
-
-
Constructor Details
-
Field
private Field()
-
-
Method Details
-
getKindValue
public int getKindValue()The field type.
.google.protobuf.Field.Kind kind = 1;
- Specified by:
getKindValue
in interfaceFieldOrBuilder
- Returns:
- The enum numeric value on the wire for kind.
-
getKind
The field type.
.google.protobuf.Field.Kind kind = 1;
- Specified by:
getKind
in interfaceFieldOrBuilder
- Returns:
- The kind.
-
setKindValue
private void setKindValue(int value) The field type.
.google.protobuf.Field.Kind kind = 1;
- Parameters:
value
- The enum numeric value on the wire for kind to set.
-
setKind
The field type.
.google.protobuf.Field.Kind kind = 1;
- Parameters:
value
- The kind to set.
-
clearKind
private void clearKind()The field type.
.google.protobuf.Field.Kind kind = 1;
-
getCardinalityValue
public int getCardinalityValue()The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
- Specified by:
getCardinalityValue
in interfaceFieldOrBuilder
- Returns:
- The enum numeric value on the wire for cardinality.
-
getCardinality
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
- Specified by:
getCardinality
in interfaceFieldOrBuilder
- Returns:
- The cardinality.
-
setCardinalityValue
private void setCardinalityValue(int value) The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
- Parameters:
value
- The enum numeric value on the wire for cardinality to set.
-
setCardinality
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
- Parameters:
value
- The cardinality to set.
-
clearCardinality
private void clearCardinality()The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;
-
getNumber
public int getNumber()The field number.
int32 number = 3;
- Specified by:
getNumber
in interfaceFieldOrBuilder
- Returns:
- The number.
-
setNumber
private void setNumber(int value) The field number.
int32 number = 3;
- Parameters:
value
- The number to set.
-
clearNumber
private void clearNumber()The field number.
int32 number = 3;
-
getName
The field name.
string name = 4;
- Specified by:
getName
in interfaceFieldOrBuilder
- Returns:
- The name.
-
getNameBytes
The field name.
string name = 4;
- Specified by:
getNameBytes
in interfaceFieldOrBuilder
- Returns:
- The bytes for name.
-
setName
The field name.
string name = 4;
- Parameters:
value
- The name to set.
-
clearName
private void clearName()The field name.
string name = 4;
-
setNameBytes
The field name.
string name = 4;
- Parameters:
value
- The bytes for name to set.
-
getTypeUrl
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
- Specified by:
getTypeUrl
in interfaceFieldOrBuilder
- Returns:
- The typeUrl.
-
getTypeUrlBytes
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
- Specified by:
getTypeUrlBytes
in interfaceFieldOrBuilder
- Returns:
- The bytes for typeUrl.
-
setTypeUrl
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
- Parameters:
value
- The typeUrl to set.
-
clearTypeUrl
private void clearTypeUrl()The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
-
setTypeUrlBytes
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;
- Parameters:
value
- The bytes for typeUrl to set.
-
getOneofIndex
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;
- Specified by:
getOneofIndex
in interfaceFieldOrBuilder
- Returns:
- The oneofIndex.
-
setOneofIndex
private void setOneofIndex(int value) 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;
- Parameters:
value
- The oneofIndex to set.
-
clearOneofIndex
private void clearOneofIndex()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;
-
getPacked
public boolean getPacked()Whether to use alternative packed wire representation.
bool packed = 8;
- Specified by:
getPacked
in interfaceFieldOrBuilder
- Returns:
- The packed.
-
setPacked
private void setPacked(boolean value) Whether to use alternative packed wire representation.
bool packed = 8;
- Parameters:
value
- The packed to set.
-
clearPacked
private void clearPacked()Whether to use alternative packed wire representation.
bool packed = 8;
-
getOptionsList
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
- Specified by:
getOptionsList
in interfaceFieldOrBuilder
-
getOptionsOrBuilderList
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
getOptionsCount
public int getOptionsCount()The protocol buffer options.
repeated .google.protobuf.Option options = 9;
- Specified by:
getOptionsCount
in interfaceFieldOrBuilder
-
getOptions
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
- Specified by:
getOptions
in interfaceFieldOrBuilder
-
getOptionsOrBuilder
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
ensureOptionsIsMutable
private void ensureOptionsIsMutable() -
setOptions
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
addOptions
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
addOptions
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
addAllOptions
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
clearOptions
private void clearOptions()The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
removeOptions
private void removeOptions(int index) The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
getJsonName
The field JSON name.
string json_name = 10;
- Specified by:
getJsonName
in interfaceFieldOrBuilder
- Returns:
- The jsonName.
-
getJsonNameBytes
The field JSON name.
string json_name = 10;
- Specified by:
getJsonNameBytes
in interfaceFieldOrBuilder
- Returns:
- The bytes for jsonName.
-
setJsonName
The field JSON name.
string json_name = 10;
- Parameters:
value
- The jsonName to set.
-
clearJsonName
private void clearJsonName()The field JSON name.
string json_name = 10;
-
setJsonNameBytes
The field JSON name.
string json_name = 10;
- Parameters:
value
- The bytes for jsonName to set.
-
getDefaultValue
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
- Specified by:
getDefaultValue
in interfaceFieldOrBuilder
- Returns:
- The defaultValue.
-
getDefaultValueBytes
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
- Specified by:
getDefaultValueBytes
in interfaceFieldOrBuilder
- Returns:
- The bytes for defaultValue.
-
setDefaultValue
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
- Parameters:
value
- The defaultValue to set.
-
clearDefaultValue
private void clearDefaultValue()The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
-
setDefaultValueBytes
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
- Parameters:
value
- The bytes for defaultValue to set.
-
parseFrom
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException - Throws:
InvalidProtocolBufferException
-
parseFrom
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException - Throws:
InvalidProtocolBufferException
-
parseFrom
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException - Throws:
InvalidProtocolBufferException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static Field parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseDelimitedFrom
- Throws:
IOException
-
parseDelimitedFrom
public static Field parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
parseFrom
- Throws:
IOException
-
parseFrom
public static Field parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException - Throws:
IOException
-
newBuilder
-
newBuilder
-
dynamicMethod
protected final Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1) Description copied from class:GeneratedMessageLite
A method that implements different types of operations described inGeneratedMessageLite.MethodToInvoke
. These 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.NEW_INSTANCE
returns a new instance of the protocol buffer that has not yet been made immutable. SeeMAKE_IMMUTABLE
.IS_INITIALIZED
returnsnull
for false and the default instance for true. It doesn't use or modify any memoized value.GET_MEMOIZED_IS_INITIALIZED
returns the memoizedisInitialized
byte value.SET_MEMOIZED_IS_INITIALIZED
sets the memoizedisInitialized
byte value to 1 if the first parameter is not null, or to 0 if the first parameter is null.NEW_BUILDER
returns aBuilderType
instance.
For use by generated code only.
- Specified by:
dynamicMethod
in classGeneratedMessageLite<Field,
Field.Builder>
-
getDefaultInstance
-
parser
-