Class OneofConstraints.Builder

  • All Implemented Interfaces:
    OneofConstraintsOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, java.lang.Cloneable
    Enclosing class:
    OneofConstraints

    public static final class OneofConstraints.Builder
    extends com.google.protobuf.GeneratedMessage.Builder<OneofConstraints.Builder>
    implements OneofConstraintsOrBuilder
     The `OneofConstraints` message type enables you to manage constraints for
     oneof fields in your protobuf messages.
     
    Protobuf type buf.validate.OneofConstraints
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OneofConstraints build()  
      OneofConstraints buildPartial()  
      OneofConstraints.Builder clear()  
      OneofConstraints.Builder clearRequired()
      If `required` is true, exactly one field of the oneof must be present.
      OneofConstraints getDefaultInstanceForType()  
      static com.google.protobuf.Descriptors.Descriptor getDescriptor()  
      com.google.protobuf.Descriptors.Descriptor getDescriptorForType()  
      boolean getRequired()
      If `required` is true, exactly one field of the oneof must be present.
      boolean hasRequired()
      If `required` is true, exactly one field of the oneof must be present.
      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()  
      boolean isInitialized()  
      OneofConstraints.Builder mergeFrom​(OneofConstraints other)  
      OneofConstraints.Builder mergeFrom​(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)  
      OneofConstraints.Builder mergeFrom​(com.google.protobuf.Message other)  
      OneofConstraints.Builder setRequired​(boolean value)
      If `required` is true, exactly one field of the oneof must be present.
      • Methods inherited from class com.google.protobuf.GeneratedMessage.Builder

        addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3
      • Methods inherited from class com.google.protobuf.AbstractMessage.Builder

        findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
      • Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

        addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.google.protobuf.Message.Builder

        mergeDelimitedFrom, mergeDelimitedFrom
      • Methods inherited from interface com.google.protobuf.MessageLite.Builder

        mergeFrom
      • Methods inherited from interface com.google.protobuf.MessageOrBuilder

        findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.Builder<OneofConstraints.Builder>
      • clear

        public OneofConstraints.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessage.Builder<OneofConstraints.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessage.Builder<OneofConstraints.Builder>
      • getDefaultInstanceForType

        public OneofConstraints getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public OneofConstraints build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public OneofConstraints buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • mergeFrom

        public OneofConstraints.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<OneofConstraints.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessage.Builder<OneofConstraints.Builder>
      • mergeFrom

        public OneofConstraints.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws java.io.IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<OneofConstraints.Builder>
        Throws:
        java.io.IOException
      • hasRequired

        public boolean hasRequired()
         If `required` is true, exactly one field of the oneof must be present. A
         validation error is returned if no fields in the oneof are present. The
         field itself may still be a default value; further constraints
         should be placed on the fields themselves to ensure they are valid values,
         such as `min_len` or `gt`.
        
         ```proto
         message MyMessage {
         oneof value {
         // Either `a` or `b` must be set. If `a` is set, it must also be
         // non-empty; whereas if `b` is set, it can still be an empty string.
         option (buf.validate.oneof).required = true;
         string a = 1 [(buf.validate.field).string.min_len = 1];
         string b = 2;
         }
         }
         ```
         
        optional bool required = 1;
        Specified by:
        hasRequired in interface OneofConstraintsOrBuilder
        Returns:
        Whether the required field is set.
      • getRequired

        public boolean getRequired()
         If `required` is true, exactly one field of the oneof must be present. A
         validation error is returned if no fields in the oneof are present. The
         field itself may still be a default value; further constraints
         should be placed on the fields themselves to ensure they are valid values,
         such as `min_len` or `gt`.
        
         ```proto
         message MyMessage {
         oneof value {
         // Either `a` or `b` must be set. If `a` is set, it must also be
         // non-empty; whereas if `b` is set, it can still be an empty string.
         option (buf.validate.oneof).required = true;
         string a = 1 [(buf.validate.field).string.min_len = 1];
         string b = 2;
         }
         }
         ```
         
        optional bool required = 1;
        Specified by:
        getRequired in interface OneofConstraintsOrBuilder
        Returns:
        The required.
      • setRequired

        public OneofConstraints.Builder setRequired​(boolean value)
         If `required` is true, exactly one field of the oneof must be present. A
         validation error is returned if no fields in the oneof are present. The
         field itself may still be a default value; further constraints
         should be placed on the fields themselves to ensure they are valid values,
         such as `min_len` or `gt`.
        
         ```proto
         message MyMessage {
         oneof value {
         // Either `a` or `b` must be set. If `a` is set, it must also be
         // non-empty; whereas if `b` is set, it can still be an empty string.
         option (buf.validate.oneof).required = true;
         string a = 1 [(buf.validate.field).string.min_len = 1];
         string b = 2;
         }
         }
         ```
         
        optional bool required = 1;
        Parameters:
        value - The required to set.
        Returns:
        This builder for chaining.
      • clearRequired

        public OneofConstraints.Builder clearRequired()
         If `required` is true, exactly one field of the oneof must be present. A
         validation error is returned if no fields in the oneof are present. The
         field itself may still be a default value; further constraints
         should be placed on the fields themselves to ensure they are valid values,
         such as `min_len` or `gt`.
        
         ```proto
         message MyMessage {
         oneof value {
         // Either `a` or `b` must be set. If `a` is set, it must also be
         // non-empty; whereas if `b` is set, it can still be an empty string.
         option (buf.validate.oneof).required = true;
         string a = 1 [(buf.validate.field).string.min_len = 1];
         string b = 2;
         }
         }
         ```
         
        optional bool required = 1;
        Returns:
        This builder for chaining.