Interface EnumRulesOrBuilder

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

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

    Modifier and Type
    Method
    Description
    int
    `const` requires the field value to exactly match the specified enum value.
    boolean
    `defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.
    int
    getIn(int index)
    `in` requires the field value to be equal to one of the specified enum values.
    int
    `in` requires the field value to be equal to one of the specified enum values.
    `in` requires the field value to be equal to one of the specified enum values.
    int
    getNotIn(int index)
    `not_in` requires the field value to be not equal to any of the specified enum values.
    int
    `not_in` requires the field value to be not equal to any of the specified enum values.
    `not_in` requires the field value to be not equal to any of the specified enum values.
    boolean
    `const` requires the field value to exactly match the specified enum value.
    boolean
    `defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.

    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 Details

    • hasConst

      boolean hasConst()
       `const` requires the field value to exactly match the specified enum value.
       If the field value doesn't match, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be exactly MY_ENUM_VALUE1.
         MyEnum value = 1 [(buf.validate.field).enum.const = 1];
       }
       ```
       
      optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
      Returns:
      Whether the const field is set.
    • getConst

      int getConst()
       `const` requires the field value to exactly match the specified enum value.
       If the field value doesn't match, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be exactly MY_ENUM_VALUE1.
         MyEnum value = 1 [(buf.validate.field).enum.const = 1];
       }
       ```
       
      optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
      Returns:
      The const.
    • hasDefinedOnly

      boolean hasDefinedOnly()
       `defined_only` requires the field value to be one of the defined values for
       this enum, failing on any undefined value.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be a defined value of MyEnum.
         MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
       }
       ```
       
      optional bool defined_only = 2 [json_name = "definedOnly"];
      Returns:
      Whether the definedOnly field is set.
    • getDefinedOnly

      boolean getDefinedOnly()
       `defined_only` requires the field value to be one of the defined values for
       this enum, failing on any undefined value.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be a defined value of MyEnum.
         MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
       }
       ```
       
      optional bool defined_only = 2 [json_name = "definedOnly"];
      Returns:
      The definedOnly.
    • getInList

      List<Integer> getInList()
       `in` requires the field value to be equal to one of the
      specified enum values. If the field value doesn't match any of the
      specified values, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be equal to one of the specified values.
         MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
       }
       ```
       
      repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
      Returns:
      A list containing the in.
    • getInCount

      int getInCount()
       `in` requires the field value to be equal to one of the
      specified enum values. If the field value doesn't match any of the
      specified values, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be equal to one of the specified values.
         MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
       }
       ```
       
      repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
      Returns:
      The count of in.
    • getIn

      int getIn(int index)
       `in` requires the field value to be equal to one of the
      specified enum values. If the field value doesn't match any of the
      specified values, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must be equal to one of the specified values.
         MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
       }
       ```
       
      repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
      Parameters:
      index - The index of the element to return.
      Returns:
      The in at the given index.
    • getNotInList

      List<Integer> getNotInList()
       `not_in` requires the field value to be not equal to any of the
      specified enum values. If the field value matches one of the specified
       values, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must not be equal to any of the specified values.
         MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
       }
       ```
       
      repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
      Returns:
      A list containing the notIn.
    • getNotInCount

      int getNotInCount()
       `not_in` requires the field value to be not equal to any of the
      specified enum values. If the field value matches one of the specified
       values, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must not be equal to any of the specified values.
         MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
       }
       ```
       
      repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
      Returns:
      The count of notIn.
    • getNotIn

      int getNotIn(int index)
       `not_in` requires the field value to be not equal to any of the
      specified enum values. If the field value matches one of the specified
       values, an error message is generated.
      
       ```proto
       enum MyEnum {
         MY_ENUM_UNSPECIFIED = 0;
         MY_ENUM_VALUE1 = 1;
         MY_ENUM_VALUE2 = 2;
       }
      
       message MyMessage {
         // The field `value` must not be equal to any of the specified values.
         MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
       }
       ```
       
      repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
      Parameters:
      index - The index of the element to return.
      Returns:
      The notIn at the given index.