Interface OneofConstraintsOrBuilder

  • All Superinterfaces:
    com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder
    All Known Implementing Classes:
    OneofConstraints, OneofConstraints.Builder

    public interface OneofConstraintsOrBuilder
    extends com.google.protobuf.MessageOrBuilder
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      • Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder

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

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

      • hasRequired

        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;
        Returns:
        Whether the required field is set.
      • getRequired

        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;
        Returns:
        The required.