Class Field.Builder

    • Method Detail

      • getDefaultInstanceForType

        public Field getDefaultInstanceForType()
        Description copied from interface: MessageLiteOrBuilder
        Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the 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.
        Specified by:
        getDefaultInstanceForType in interface MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface MessageOrBuilder
      • mergeFrom

        public Field.Builder mergeFrom​(Message other)
        Description copied from interface: Message.Builder
        Merge 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:
        * For singular primitive fields, if the field is set in other, then other's value overwrites the value in this message.
        * For singular message fields, if the field is set in other, it is merged into the corresponding sub-message of this message using the same merging rules.
        * For repeated fields, the elements in other are concatenated with the elements in this message.
        * For oneof groups, if the other message has one of the fields set, the group of this message is cleared and replaced by the field of the other message, so that the oneof constraint is preserved.

        This is equivalent to the Message::MergeFrom method in C++.

        Specified by:
        mergeFrom in interface Message.Builder
        Overrides:
        mergeFrom in class AbstractMessage.Builder<Field.Builder>
      • getKindValue

        public int getKindValue()
         The field type.
         
        .google.protobuf.Field.Kind kind = 1;
        Specified by:
        getKindValue in interface FieldOrBuilder
        Returns:
        The enum numeric value on the wire for kind.
      • setKindValue

        public Field.Builder 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.
        Returns:
        This builder for chaining.
      • getKind

        public Field.Kind getKind()
         The field type.
         
        .google.protobuf.Field.Kind kind = 1;
        Specified by:
        getKind in interface FieldOrBuilder
        Returns:
        The kind.
      • setKind

        public Field.Builder setKind​(Field.Kind value)
         The field type.
         
        .google.protobuf.Field.Kind kind = 1;
        Parameters:
        value - The kind to set.
        Returns:
        This builder for chaining.
      • clearKind

        public Field.Builder clearKind()
         The field type.
         
        .google.protobuf.Field.Kind kind = 1;
        Returns:
        This builder for chaining.
      • getCardinalityValue

        public int getCardinalityValue()
         The field cardinality.
         
        .google.protobuf.Field.Cardinality cardinality = 2;
        Specified by:
        getCardinalityValue in interface FieldOrBuilder
        Returns:
        The enum numeric value on the wire for cardinality.
      • setCardinalityValue

        public Field.Builder 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.
        Returns:
        This builder for chaining.
      • setCardinality

        public Field.Builder setCardinality​(Field.Cardinality value)
         The field cardinality.
         
        .google.protobuf.Field.Cardinality cardinality = 2;
        Parameters:
        value - The cardinality to set.
        Returns:
        This builder for chaining.
      • clearCardinality

        public Field.Builder clearCardinality()
         The field cardinality.
         
        .google.protobuf.Field.Cardinality cardinality = 2;
        Returns:
        This builder for chaining.
      • getNumber

        public int getNumber()
         The field number.
         
        int32 number = 3;
        Specified by:
        getNumber in interface FieldOrBuilder
        Returns:
        The number.
      • setNumber

        public Field.Builder setNumber​(int value)
         The field number.
         
        int32 number = 3;
        Parameters:
        value - The number to set.
        Returns:
        This builder for chaining.
      • clearNumber

        public Field.Builder clearNumber()
         The field number.
         
        int32 number = 3;
        Returns:
        This builder for chaining.
      • getName

        public java.lang.String getName()
         The field name.
         
        string name = 4;
        Specified by:
        getName in interface FieldOrBuilder
        Returns:
        The name.
      • setName

        public Field.Builder setName​(java.lang.String value)
         The field name.
         
        string name = 4;
        Parameters:
        value - The name to set.
        Returns:
        This builder for chaining.
      • clearName

        public Field.Builder clearName()
         The field name.
         
        string name = 4;
        Returns:
        This builder for chaining.
      • setNameBytes

        public Field.Builder setNameBytes​(ByteString value)
         The field name.
         
        string name = 4;
        Parameters:
        value - The bytes for name to set.
        Returns:
        This builder for chaining.
      • 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:
        getTypeUrl in interface FieldOrBuilder
        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:
        getTypeUrlBytes in interface FieldOrBuilder
        Returns:
        The bytes for typeUrl.
      • setTypeUrl

        public Field.Builder 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.
        Returns:
        This builder for chaining.
      • clearTypeUrl

        public Field.Builder clearTypeUrl()
         The field type URL, without the scheme, for message or enumeration
         types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
         
        string type_url = 6;
        Returns:
        This builder for chaining.
      • setTypeUrlBytes

        public Field.Builder 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.
        Returns:
        This builder for chaining.
      • 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 interface FieldOrBuilder
        Returns:
        The oneofIndex.
      • setOneofIndex

        public Field.Builder 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.
        Returns:
        This builder for chaining.
      • clearOneofIndex

        public Field.Builder 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;
        Returns:
        This builder for chaining.
      • getPacked

        public boolean getPacked()
         Whether to use alternative packed wire representation.
         
        bool packed = 8;
        Specified by:
        getPacked in interface FieldOrBuilder
        Returns:
        The packed.
      • setPacked

        public Field.Builder setPacked​(boolean value)
         Whether to use alternative packed wire representation.
         
        bool packed = 8;
        Parameters:
        value - The packed to set.
        Returns:
        This builder for chaining.
      • clearPacked

        public Field.Builder clearPacked()
         Whether to use alternative packed wire representation.
         
        bool packed = 8;
        Returns:
        This builder for chaining.
      • getOptionsList

        public java.util.List<Option> getOptionsList()
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
        Specified by:
        getOptionsList in interface FieldOrBuilder
      • getOptionsCount

        public int getOptionsCount()
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
        Specified by:
        getOptionsCount in interface FieldOrBuilder
      • getOptions

        public Option getOptions​(int index)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
        Specified by:
        getOptions in interface FieldOrBuilder
      • setOptions

        public Field.Builder setOptions​(int index,
                                        Option value)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • setOptions

        public Field.Builder setOptions​(int index,
                                        Option.Builder builderForValue)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addOptions

        public Field.Builder addOptions​(Option value)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addOptions

        public Field.Builder addOptions​(int index,
                                        Option value)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addOptions

        public Field.Builder addOptions​(Option.Builder builderForValue)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addOptions

        public Field.Builder addOptions​(int index,
                                        Option.Builder builderForValue)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addAllOptions

        public Field.Builder addAllOptions​(java.lang.Iterable<? extends Option> values)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • clearOptions

        public Field.Builder clearOptions()
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • removeOptions

        public Field.Builder removeOptions​(int index)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • getOptionsBuilder

        public Option.Builder getOptionsBuilder​(int index)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addOptionsBuilder

        public Option.Builder addOptionsBuilder()
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • addOptionsBuilder

        public Option.Builder addOptionsBuilder​(int index)
         The protocol buffer options.
         
        repeated .google.protobuf.Option options = 9;
      • getOptionsBuilderList

        public java.util.List<Option.Builder> getOptionsBuilderList()
         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:
        getJsonName in interface FieldOrBuilder
        Returns:
        The jsonName.
      • setJsonName

        public Field.Builder setJsonName​(java.lang.String value)
         The field JSON name.
         
        string json_name = 10;
        Parameters:
        value - The jsonName to set.
        Returns:
        This builder for chaining.
      • clearJsonName

        public Field.Builder clearJsonName()
         The field JSON name.
         
        string json_name = 10;
        Returns:
        This builder for chaining.
      • setJsonNameBytes

        public Field.Builder setJsonNameBytes​(ByteString value)
         The field JSON name.
         
        string json_name = 10;
        Parameters:
        value - The bytes for jsonName to set.
        Returns:
        This builder for chaining.
      • 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:
        getDefaultValue in interface FieldOrBuilder
        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:
        getDefaultValueBytes in interface FieldOrBuilder
        Returns:
        The bytes for defaultValue.
      • setDefaultValue

        public Field.Builder 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.
        Returns:
        This builder for chaining.
      • clearDefaultValue

        public Field.Builder clearDefaultValue()
         The string value of the default value of this field. Proto2 syntax only.
         
        string default_value = 11;
        Returns:
        This builder for chaining.
      • setDefaultValueBytes

        public Field.Builder 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.
        Returns:
        This builder for chaining.