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.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 static intCARDINALITY_FIELD_NUMBERstatic intDEFAULT_VALUE_FIELD_NUMBERstatic intJSON_NAME_FIELD_NUMBERstatic intKIND_FIELD_NUMBERstatic intNAME_FIELD_NUMBERstatic intNUMBER_FIELD_NUMBERstatic intONEOF_INDEX_FIELD_NUMBERstatic intOPTIONS_FIELD_NUMBERstatic intPACKED_FIELD_NUMBERstatic intTYPE_URL_FIELD_NUMBER-
Fields inherited from class com.google.protobuf.GeneratedMessageLite
unknownFields
-
Fields inherited from class com.google.protobuf.AbstractMessageLite
memoizedHashCode
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ObjectdynamicMethod(GeneratedMessageLite.MethodToInvoke method, Object arg0, Object arg1)A method that implements different types of operations described inGeneratedMessageLite.MethodToInvoke.Field.CardinalitygetCardinality()The field cardinality.intgetCardinalityValue()The field cardinality.static FieldgetDefaultInstance()StringgetDefaultValue()The string value of the default value of this field.ByteStringgetDefaultValueBytes()The string value of the default value of this field.StringgetJsonName()The field JSON name.ByteStringgetJsonNameBytes()The field JSON name.Field.KindgetKind()The field type.intgetKindValue()The field type.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.List<Option>getOptionsList()The protocol buffer options.OptionOrBuildergetOptionsOrBuilder(int index)The protocol buffer options.List<? extends OptionOrBuilder>getOptionsOrBuilderList()The protocol buffer options.booleangetPacked()Whether to use alternative packed wire representation.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(InputStream input)static FieldparseDelimitedFrom(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(InputStream input)static FieldparseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)static FieldparseFrom(ByteBuffer data)static FieldparseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)static Parser<Field>parser()-
Methods inherited from class com.google.protobuf.GeneratedMessageLite
createBuilder, createBuilder, dynamicMethod, dynamicMethod, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, emptyProtobufList, equals, getDefaultInstanceForType, getParserForType, getSerializedSize, hashCode, isInitialized, isInitialized, makeImmutable, mergeLengthDelimitedField, mergeUnknownFields, mergeVarintField, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBuilderForType, newMessageInfo, newRepeatedGeneratedExtension, newSingularGeneratedExtension, parseDelimitedFrom, parseDelimitedFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parseFrom, parsePartialFrom, parseUnknownField, registerDefaultInstance, toBuilder, toString, writeTo
-
Methods inherited from class com.google.protobuf.AbstractMessageLite
addAll, addAll, checkByteStringIsUtf8, 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
-
CARDINALITY_FIELD_NUMBER
public static final int CARDINALITY_FIELD_NUMBER
- See Also:
- Constant Field Values
-
NUMBER_FIELD_NUMBER
public static final int NUMBER_FIELD_NUMBER
- See Also:
- Constant Field Values
-
NAME_FIELD_NUMBER
public static final int NAME_FIELD_NUMBER
- See Also:
- Constant Field Values
-
TYPE_URL_FIELD_NUMBER
public static final int TYPE_URL_FIELD_NUMBER
- See Also:
- Constant Field Values
-
ONEOF_INDEX_FIELD_NUMBER
public static final int ONEOF_INDEX_FIELD_NUMBER
- See Also:
- Constant Field Values
-
PACKED_FIELD_NUMBER
public static final int PACKED_FIELD_NUMBER
- See Also:
- Constant Field Values
-
OPTIONS_FIELD_NUMBER
public static final int OPTIONS_FIELD_NUMBER
- See Also:
- Constant Field Values
-
JSON_NAME_FIELD_NUMBER
public static final int JSON_NAME_FIELD_NUMBER
- See Also:
- Constant Field Values
-
DEFAULT_VALUE_FIELD_NUMBER
public static final int DEFAULT_VALUE_FIELD_NUMBER
- See Also:
- Constant Field Values
-
-
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.
-
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.
-
getNumber
public int getNumber()
The field number.
int32 number = 3;- Specified by:
getNumberin interfaceFieldOrBuilder- Returns:
- The number.
-
getName
public 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.
-
getTypeUrl
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;- 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.
-
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.
-
getPacked
public boolean getPacked()
Whether to use alternative packed wire representation.
bool packed = 8;- Specified by:
getPackedin interfaceFieldOrBuilder- Returns:
- The packed.
-
getOptionsList
public List<Option> getOptionsList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;- Specified by:
getOptionsListin interfaceFieldOrBuilder
-
getOptionsOrBuilderList
public 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;
-
getJsonName
public 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.
-
getDefaultValue
public 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.
-
parseFrom
public static Field parseFrom(ByteBuffer data) throws InvalidProtocolBufferException
- Throws:
InvalidProtocolBufferException
-
parseFrom
public static Field parseFrom(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(InputStream input) throws IOException
- Throws:
IOException
-
parseFrom
public static Field parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
parseDelimitedFrom
public static Field parseDelimitedFrom(InputStream input) throws IOException
- Throws:
IOException
-
parseDelimitedFrom
public static Field parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
parseFrom
public static Field parseFrom(CodedInputStream input) throws IOException
- Throws:
IOException
-
parseFrom
public static Field parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
- Throws:
IOException
-
newBuilder
public static Field.Builder newBuilder()
-
newBuilder
public static Field.Builder newBuilder(Field prototype)
-
dynamicMethod
protected final Object dynamicMethod(GeneratedMessageLite.MethodToInvoke method, Object arg0, 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()
-
-