Package com.google.protobuf
Class Field
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite<MessageType,BuilderType>
-
- com.google.protobuf.GeneratedMessageLite<Field,Field.Builder>
-
- com.google.protobuf.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 typegoogle.protobuf.Field
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classField.BuilderA single field of a message type.static classField.CardinalityWhether a field is optional, required, or repeated.static classField.KindBasic 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
Fields Modifier and Type Field Description private intcardinality_static intCARDINALITY_FIELD_NUMBERprivate static FieldDEFAULT_INSTANCEstatic intDEFAULT_VALUE_FIELD_NUMBERprivate java.lang.StringdefaultValue_static intJSON_NAME_FIELD_NUMBERprivate java.lang.StringjsonName_private intkind_static intKIND_FIELD_NUMBERprivate java.lang.Stringname_static intNAME_FIELD_NUMBERprivate intnumber_static intNUMBER_FIELD_NUMBERstatic intONEOF_INDEX_FIELD_NUMBERprivate intoneofIndex_private Internal.ProtobufList<Option>options_static intOPTIONS_FIELD_NUMBERprivate booleanpacked_static intPACKED_FIELD_NUMBERprivate static Parser<Field>PARSERstatic intTYPE_URL_FIELD_NUMBERprivate java.lang.StringtypeUrl_-
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 Modifier Constructor Description privateField()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddAllOptions(java.lang.Iterable<? extends Option> values)The protocol buffer options.private voidaddOptions(int index, Option value)The protocol buffer options.private voidaddOptions(Option value)The protocol buffer options.private voidclearCardinality()The field cardinality.private voidclearDefaultValue()The string value of the default value of this field.private voidclearJsonName()The field JSON name.private voidclearKind()The field type.private voidclearName()The field name.private voidclearNumber()The field number.private voidclearOneofIndex()The index of the field type in `Type.oneofs`, for message or enumeration types.private voidclearOptions()The protocol buffer options.private voidclearPacked()Whether to use alternative packed wire representation.private voidclearTypeUrl()The field type URL, without the scheme, for message or enumeration types.protected java.lang.ObjectdynamicMethod(GeneratedMessageLite.MethodToInvoke method, java.lang.Object arg0, java.lang.Object arg1)A method that implements different types of operations described inGeneratedMessageLite.MethodToInvoke.private voidensureOptionsIsMutable()Field.CardinalitygetCardinality()The field cardinality.intgetCardinalityValue()The field cardinality.static FieldgetDefaultInstance()java.lang.StringgetDefaultValue()The string value of the default value of this field.ByteStringgetDefaultValueBytes()The string value of the default value of this field.java.lang.StringgetJsonName()The field JSON name.ByteStringgetJsonNameBytes()The field JSON name.Field.KindgetKind()The field type.intgetKindValue()The field type.java.lang.StringgetName()The field name.ByteStringgetNameBytes()The field name.intgetNumber()The field number.intgetOneofIndex()The index of the field type in `Type.oneofs`, for message or enumeration types.OptiongetOptions(int index)The protocol buffer options.intgetOptionsCount()The protocol buffer options.java.util.List<Option>getOptionsList()The protocol buffer options.OptionOrBuildergetOptionsOrBuilder(int index)The protocol buffer options.java.util.List<? extends OptionOrBuilder>getOptionsOrBuilderList()The protocol buffer options.booleangetPacked()Whether to use alternative packed wire representation.java.lang.StringgetTypeUrl()The field type URL, without the scheme, for message or enumeration types.ByteStringgetTypeUrlBytes()The field type URL, without the scheme, for message or enumeration types.static Field.BuildernewBuilder()static Field.BuildernewBuilder(Field prototype)static FieldparseDelimitedFrom(java.io.InputStream input)static FieldparseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)static FieldparseFrom(byte[] data)static FieldparseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)static FieldparseFrom(ByteString data)static FieldparseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)static FieldparseFrom(CodedInputStream input)static FieldparseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)static FieldparseFrom(java.io.InputStream input)static FieldparseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry)static FieldparseFrom(java.nio.ByteBuffer data)static FieldparseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry)static Parser<Field>parser()private voidremoveOptions(int index)The protocol buffer options.private voidsetCardinality(Field.Cardinality value)The field cardinality.private voidsetCardinalityValue(int value)The field cardinality.private voidsetDefaultValue(java.lang.String value)The string value of the default value of this field.private voidsetDefaultValueBytes(ByteString value)The string value of the default value of this field.private voidsetJsonName(java.lang.String value)The field JSON name.private voidsetJsonNameBytes(ByteString value)The field JSON name.private voidsetKind(Field.Kind value)The field type.private voidsetKindValue(int value)The field type.private voidsetName(java.lang.String value)The field name.private voidsetNameBytes(ByteString value)The field name.private voidsetNumber(int value)The field number.private voidsetOneofIndex(int value)The index of the field type in `Type.oneofs`, for message or enumeration types.private voidsetOptions(int index, Option value)The protocol buffer options.private voidsetPacked(boolean value)Whether to use alternative packed wire representation.private voidsetTypeUrl(java.lang.String value)The field type URL, without the scheme, for message or enumeration types.private voidsetTypeUrlBytes(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 Detail
-
KIND_FIELD_NUMBER
public static final int KIND_FIELD_NUMBER
- See Also:
- Constant Field Values
-
kind_
private int kind_
-
CARDINALITY_FIELD_NUMBER
public static final int CARDINALITY_FIELD_NUMBER
- See Also:
- Constant Field Values
-
cardinality_
private int cardinality_
-
NUMBER_FIELD_NUMBER
public static final int NUMBER_FIELD_NUMBER
- See Also:
- Constant Field Values
-
number_
private int number_
-
NAME_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER
- See Also:
- Constant Field Values
-
name_
private java.lang.String name_
-
TYPE_URL_FIELD_NUMBER
public static final int TYPE_URL_FIELD_NUMBER
- See Also:
- Constant Field Values
-
typeUrl_
private java.lang.String typeUrl_
-
ONEOF_INDEX_FIELD_NUMBER
public static final int ONEOF_INDEX_FIELD_NUMBER
- See Also:
- Constant Field Values
-
oneofIndex_
private int oneofIndex_
-
PACKED_FIELD_NUMBER
public static final int PACKED_FIELD_NUMBER
- See Also:
- Constant Field Values
-
packed_
private boolean packed_
-
OPTIONS_FIELD_NUMBER
public static final int OPTIONS_FIELD_NUMBER
- See Also:
- Constant Field Values
-
options_
private Internal.ProtobufList<Option> options_
-
JSON_NAME_FIELD_NUMBER
public static final int JSON_NAME_FIELD_NUMBER
- See Also:
- Constant Field Values
-
jsonName_
private java.lang.String jsonName_
-
DEFAULT_VALUE_FIELD_NUMBER
public static final int DEFAULT_VALUE_FIELD_NUMBER
- See Also:
- Constant Field Values
-
defaultValue_
private java.lang.String defaultValue_
-
DEFAULT_INSTANCE
private static final Field DEFAULT_INSTANCE
-
-
Method Detail
-
getKindValue
public int getKindValue()
The field type.
.google.protobuf.Field.Kind kind = 1;- Specified by:
getKindValuein interfaceFieldOrBuilder- Returns:
- The enum numeric value on the wire for kind.
-
getKind
public Field.Kind getKind()
The field type.
.google.protobuf.Field.Kind kind = 1;- Specified by:
getKindin 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
private void setKind(Field.Kind value)
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:
getCardinalityValuein interfaceFieldOrBuilder- Returns:
- The enum numeric value on the wire for cardinality.
-
getCardinality
public Field.Cardinality getCardinality()
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;- Specified by:
getCardinalityin 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
private void setCardinality(Field.Cardinality value)
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:
getNumberin 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
public java.lang.String getName()
The field name.
string name = 4;- Specified by:
getNamein interfaceFieldOrBuilder- Returns:
- The name.
-
getNameBytes
public ByteString getNameBytes()
The field name.
string name = 4;- Specified by:
getNameBytesin interfaceFieldOrBuilder- Returns:
- The bytes for name.
-
setName
private void setName(java.lang.String value)
The field name.
string name = 4;- Parameters:
value- The name to set.
-
clearName
private void clearName()
The field name.
string name = 4;
-
setNameBytes
private void setNameBytes(ByteString value)
The field name.
string name = 4;- Parameters:
value- The bytes for name to set.
-
getTypeUrl
public java.lang.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;- Specified by:
getTypeUrlin interfaceFieldOrBuilder- Returns:
- The typeUrl.
-
getTypeUrlBytes
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;- Specified by:
getTypeUrlBytesin interfaceFieldOrBuilder- Returns:
- The bytes for typeUrl.
-
setTypeUrl
private void setTypeUrl(java.lang.String value)
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
private void setTypeUrlBytes(ByteString value)
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:
getOneofIndexin 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:
getPackedin 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
public java.util.List<Option> getOptionsList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;- Specified by:
getOptionsListin interfaceFieldOrBuilder
-
getOptionsOrBuilderList
public java.util.List<? extends OptionOrBuilder> 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:
getOptionsCountin interfaceFieldOrBuilder
-
getOptions
public Option getOptions(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;- Specified by:
getOptionsin interfaceFieldOrBuilder
-
getOptionsOrBuilder
public OptionOrBuilder getOptionsOrBuilder(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
ensureOptionsIsMutable
private void ensureOptionsIsMutable()
-
setOptions
private void setOptions(int index, Option value)The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
addOptions
private void addOptions(Option value)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
addOptions
private void addOptions(int index, Option value)The protocol buffer options.
repeated .google.protobuf.Option options = 9;
-
addAllOptions
private void addAllOptions(java.lang.Iterable<? extends Option> values)
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
public java.lang.String getJsonName()
The field JSON name.
string json_name = 10;- Specified by:
getJsonNamein interfaceFieldOrBuilder- Returns:
- The jsonName.
-
getJsonNameBytes
public ByteString getJsonNameBytes()
The field JSON name.
string json_name = 10;- Specified by:
getJsonNameBytesin interfaceFieldOrBuilder- Returns:
- The bytes for jsonName.
-
setJsonName
private void setJsonName(java.lang.String value)
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
private void setJsonNameBytes(ByteString value)
The field JSON name.
string json_name = 10;- Parameters:
value- The bytes for jsonName to set.
-
getDefaultValue
public java.lang.String getDefaultValue()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;- Specified by:
getDefaultValuein interfaceFieldOrBuilder- Returns:
- The defaultValue.
-
getDefaultValueBytes
public ByteString getDefaultValueBytes()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;- Specified by:
getDefaultValueBytesin interfaceFieldOrBuilder- Returns:
- The bytes for defaultValue.
-
setDefaultValue
private void setDefaultValue(java.lang.String value)
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
private void setDefaultValueBytes(ByteString value)
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
public static Field parseFrom(java.nio.ByteBuffer data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(java.nio.ByteBuffer data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(ByteString data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(byte[] data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Field parseFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
parseDelimitedFrom
public static Field parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseDelimitedFrom
public static Field parseDelimitedFrom(java.io.InputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Field parseFrom(CodedInputStream input) throws java.io.IOException
- Throws:
java.io.IOException
-
parseFrom
public static Field parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
newBuilder
public static Field.Builder newBuilder()
-
newBuilder
public static Field.Builder newBuilder(Field prototype)
-
dynamicMethod
protected final java.lang.Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method, java.lang.Object arg0, java.lang.Object arg1)
Description copied from class:GeneratedMessageLiteA 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_INSTANCEreturns a new instance of the protocol buffer that has not yet been made immutable. SeeMAKE_IMMUTABLE.IS_INITIALIZEDreturnsnullfor false and the default instance for true. It doesn't use or modify any memoized value.GET_MEMOIZED_IS_INITIALIZEDreturns the memoizedisInitializedbyte value.SET_MEMOIZED_IS_INITIALIZEDsets the memoizedisInitializedbyte value to 1 if the first parameter is not null, or to 0 if the first parameter is null.NEW_BUILDERreturns aBuilderTypeinstance.
For use by generated code only.
- Specified by:
dynamicMethodin classGeneratedMessageLite<Field,Field.Builder>
-
getDefaultInstance
public static Field getDefaultInstance()
-
-