Package build.buf.validate
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetConst()`const` requires the field value to exactly match the specified enum value.booleangetDefinedOnly()`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.intgetIn(int index)`in` requires the field value to be equal to one of the specified enum values.intgetInCount()`in` requires the field value to be equal to one of the specified enum values.java.util.List<java.lang.Integer>getInList()`in` requires the field value to be equal to one of the specified enum values.intgetNotIn(int index)`not_in` requires the field value to be not equal to any of the specified enum values.intgetNotInCount()`not_in` requires the field value to be not equal to any of the specified enum values.java.util.List<java.lang.Integer>getNotInList()`not_in` requires the field value to be not equal to any of the specified enum values.booleanhasConst()`const` requires the field value to exactly match the specified enum value.booleanhasDefinedOnly()`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.MessageOrBuilder
findInitializationErrors, getAllFields, getDefaultInstanceForType, getDescriptorForType, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
-
-
-
Method Detail
-
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 [(.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 [(.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;- 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;- Returns:
- The definedOnly.
-
getInList
java.util.List<java.lang.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 [(.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 [(.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 [(.buf.validate.priv.field) = { ... }- Parameters:
index- The index of the element to return.- Returns:
- The in at the given index.
-
getNotInList
java.util.List<java.lang.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 [(.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 [(.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 [(.buf.validate.priv.field) = { ... }- Parameters:
index- The index of the element to return.- Returns:
- The notIn at the given index.
-
-