Class OneofConstraints.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
build.buf.validate.OneofConstraints.Builder
All Implemented Interfaces:
OneofConstraintsOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
Enclosing class:
OneofConstraints

public static final class OneofConstraints.Builder extends com.google.protobuf.GeneratedMessageV3.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 Details

    • getDescriptor

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

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.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.GeneratedMessageV3.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.GeneratedMessageV3.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
    • clone

      public OneofConstraints.Builder clone()
      Specified by:
      clone in interface com.google.protobuf.Message.Builder
      Specified by:
      clone in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clone in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
    • setField

      public OneofConstraints.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      setField in interface com.google.protobuf.Message.Builder
      Overrides:
      setField in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
    • clearField

      public OneofConstraints.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
      Specified by:
      clearField in interface com.google.protobuf.Message.Builder
      Overrides:
      clearField in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
    • clearOneof

      public OneofConstraints.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      Specified by:
      clearOneof in interface com.google.protobuf.Message.Builder
      Overrides:
      clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
    • setRepeatedField

      public OneofConstraints.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
      Specified by:
      setRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
    • addRepeatedField

      public OneofConstraints.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      addRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.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>
    • mergeFrom

      public OneofConstraints.Builder mergeFrom(OneofConstraints other)
    • isInitialized

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

      public OneofConstraints.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws 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:
      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 [json_name = "required"];
      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 [json_name = "required"];
      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 [json_name = "required"];
      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 [json_name = "required"];
      Returns:
      This builder for chaining.
    • setUnknownFields

      public final OneofConstraints.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      setUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>
    • mergeUnknownFields

      public final OneofConstraints.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      mergeUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<OneofConstraints.Builder>