Package build.buf.validate
Interface BytesRulesOrBuilder
- All Superinterfaces:
com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder
- All Known Implementing Classes:
BytesRules,BytesRules.Builder
public interface BytesRulesOrBuilder
extends com.google.protobuf.MessageOrBuilder
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.protobuf.ByteStringgetConst()`const` requires the field value to exactly match the specified bytes value.com.google.protobuf.ByteString`contains` requires the field value to have the specified bytes anywhere in the string.com.google.protobuf.ByteStringgetIn(int index) `in` requires the field value to be equal to one of the specified values.int`in` requires the field value to be equal to one of the specified values.List<com.google.protobuf.ByteString>`in` requires the field value to be equal to one of the specified values.booleangetIp()`ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format.booleangetIpv4()`ipv4` ensures that the field `value` is a valid IPv4 address in byte format.booleangetIpv6()`ipv6` ensures that the field `value` is a valid IPv6 address in byte format.longgetLen()`len` requires the field value to have the specified length in bytes.long`max_len` requires the field value to have at most the specified maximum length in bytes.long`min_len` requires the field value to have at least the specified minimum length in bytes.com.google.protobuf.ByteStringgetNotIn(int index) `not_in` requires the field value to be not equal to any of the specified values.int`not_in` requires the field value to be not equal to any of the specified values.List<com.google.protobuf.ByteString>`not_in` requires the field value to be not equal to any of the specified values.`pattern` requires the field value to match the specified regular expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)).com.google.protobuf.ByteString`pattern` requires the field value to match the specified regular expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)).com.google.protobuf.ByteString`prefix` requires the field value to have the specified bytes at the beginning of the string.com.google.protobuf.ByteString`suffix` requires the field value to have the specified bytes at the end of the string.booleanhasConst()`const` requires the field value to exactly match the specified bytes value.boolean`contains` requires the field value to have the specified bytes anywhere in the string.booleanhasIp()`ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format.booleanhasIpv4()`ipv4` ensures that the field `value` is a valid IPv4 address in byte format.booleanhasIpv6()`ipv6` ensures that the field `value` is a valid IPv6 address in byte format.booleanhasLen()`len` requires the field value to have the specified length in bytes.boolean`max_len` requires the field value to have at most the specified maximum length in bytes.boolean`min_len` requires the field value to have at least the specified minimum length in bytes.boolean`pattern` requires the field value to match the specified regular expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)).boolean`prefix` requires the field value to have the specified bytes at the beginning of the string.boolean`suffix` requires the field value to have the specified bytes at the end of the string.Methods inherited from interface com.google.protobuf.MessageLiteOrBuilder
isInitializedMethods 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 bytes value. If the field value doesn't match, an error message is generated. ```proto message MyBytes { // value must be "\x01\x02\x03\x04" bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; } ```optional bytes const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the const field is set.
-
getConst
com.google.protobuf.ByteString getConst()`const` requires the field value to exactly match the specified bytes value. If the field value doesn't match, an error message is generated. ```proto message MyBytes { // value must be "\x01\x02\x03\x04" bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; } ```optional bytes const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }- Returns:
- The const.
-
hasLen
boolean hasLen()`len` requires the field value to have the specified length in bytes. If the field value doesn't match, an error message is generated. ```proto message MyBytes { // value length must be 4 bytes. optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; } ```optional uint64 len = 13 [json_name = "len", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the len field is set.
-
getLen
long getLen()`len` requires the field value to have the specified length in bytes. If the field value doesn't match, an error message is generated. ```proto message MyBytes { // value length must be 4 bytes. optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; } ```optional uint64 len = 13 [json_name = "len", (.buf.validate.priv.field) = { ... }- Returns:
- The len.
-
hasMinLen
boolean hasMinLen()`min_len` requires the field value to have at least the specified minimum length in bytes. If the field value doesn't meet the requirement, an error message is generated. ```proto message MyBytes { // value length must be at least 2 bytes. optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; } ```optional uint64 min_len = 2 [json_name = "minLen", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the minLen field is set.
-
getMinLen
long getMinLen()`min_len` requires the field value to have at least the specified minimum length in bytes. If the field value doesn't meet the requirement, an error message is generated. ```proto message MyBytes { // value length must be at least 2 bytes. optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; } ```optional uint64 min_len = 2 [json_name = "minLen", (.buf.validate.priv.field) = { ... }- Returns:
- The minLen.
-
hasMaxLen
boolean hasMaxLen()`max_len` requires the field value to have at most the specified maximum length in bytes. If the field value exceeds the requirement, an error message is generated. ```proto message MyBytes { // value must be at most 6 bytes. optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; } ```optional uint64 max_len = 3 [json_name = "maxLen", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the maxLen field is set.
-
getMaxLen
long getMaxLen()`max_len` requires the field value to have at most the specified maximum length in bytes. If the field value exceeds the requirement, an error message is generated. ```proto message MyBytes { // value must be at most 6 bytes. optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; } ```optional uint64 max_len = 3 [json_name = "maxLen", (.buf.validate.priv.field) = { ... }- Returns:
- The maxLen.
-
hasPattern
boolean hasPattern()`pattern` requires the field value to match the specified regular expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). The value of the field must be valid UTF-8 or validation will fail with a runtime error. If the field value doesn't match the pattern, an error message is generated. ```proto message MyBytes { // value must match regex pattern "^[a-zA-Z0-9]+$". optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; } ```optional string pattern = 4 [json_name = "pattern", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the pattern field is set.
-
getPattern
String getPattern()`pattern` requires the field value to match the specified regular expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). The value of the field must be valid UTF-8 or validation will fail with a runtime error. If the field value doesn't match the pattern, an error message is generated. ```proto message MyBytes { // value must match regex pattern "^[a-zA-Z0-9]+$". optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; } ```optional string pattern = 4 [json_name = "pattern", (.buf.validate.priv.field) = { ... }- Returns:
- The pattern.
-
getPatternBytes
com.google.protobuf.ByteString getPatternBytes()`pattern` requires the field value to match the specified regular expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). The value of the field must be valid UTF-8 or validation will fail with a runtime error. If the field value doesn't match the pattern, an error message is generated. ```proto message MyBytes { // value must match regex pattern "^[a-zA-Z0-9]+$". optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; } ```optional string pattern = 4 [json_name = "pattern", (.buf.validate.priv.field) = { ... }- Returns:
- The bytes for pattern.
-
hasPrefix
boolean hasPrefix()`prefix` requires the field value to have the specified bytes at the beginning of the string. If the field value doesn't meet the requirement, an error message is generated. ```proto message MyBytes { // value does not have prefix \x01\x02 optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; } ```optional bytes prefix = 5 [json_name = "prefix", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the prefix field is set.
-
getPrefix
com.google.protobuf.ByteString getPrefix()`prefix` requires the field value to have the specified bytes at the beginning of the string. If the field value doesn't meet the requirement, an error message is generated. ```proto message MyBytes { // value does not have prefix \x01\x02 optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; } ```optional bytes prefix = 5 [json_name = "prefix", (.buf.validate.priv.field) = { ... }- Returns:
- The prefix.
-
hasSuffix
boolean hasSuffix()`suffix` requires the field value to have the specified bytes at the end of the string. If the field value doesn't meet the requirement, an error message is generated. ```proto message MyBytes { // value does not have suffix \x03\x04 optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; } ```optional bytes suffix = 6 [json_name = "suffix", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the suffix field is set.
-
getSuffix
com.google.protobuf.ByteString getSuffix()`suffix` requires the field value to have the specified bytes at the end of the string. If the field value doesn't meet the requirement, an error message is generated. ```proto message MyBytes { // value does not have suffix \x03\x04 optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; } ```optional bytes suffix = 6 [json_name = "suffix", (.buf.validate.priv.field) = { ... }- Returns:
- The suffix.
-
hasContains
boolean hasContains()`contains` requires the field value to have the specified bytes anywhere in the string. If the field value doesn't meet the requirement, an error message is generated. ```protobuf message MyBytes { // value does not contain \x02\x03 optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; } ```optional bytes contains = 7 [json_name = "contains", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the contains field is set.
-
getContains
com.google.protobuf.ByteString getContains()`contains` requires the field value to have the specified bytes anywhere in the string. If the field value doesn't meet the requirement, an error message is generated. ```protobuf message MyBytes { // value does not contain \x02\x03 optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; } ```optional bytes contains = 7 [json_name = "contains", (.buf.validate.priv.field) = { ... }- Returns:
- The contains.
-
getInList
List<com.google.protobuf.ByteString> getInList()`in` requires the field value to be equal to one of the specified values. If the field value doesn't match any of the specified values, an error message is generated. ```protobuf message MyBytes { // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; } ```repeated bytes in = 8 [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 values. If the field value doesn't match any of the specified values, an error message is generated. ```protobuf message MyBytes { // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; } ```repeated bytes in = 8 [json_name = "in", (.buf.validate.priv.field) = { ... }- Returns:
- The count of in.
-
getIn
com.google.protobuf.ByteString getIn(int index) `in` requires the field value to be equal to one of the specified values. If the field value doesn't match any of the specified values, an error message is generated. ```protobuf message MyBytes { // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; } ```repeated bytes in = 8 [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<com.google.protobuf.ByteString> getNotInList()`not_in` requires the field value to be not equal to any of the specified values. If the field value matches any of the specified values, an error message is generated. ```proto message MyBytes { // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; } ```repeated bytes not_in = 9 [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 values. If the field value matches any of the specified values, an error message is generated. ```proto message MyBytes { // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; } ```repeated bytes not_in = 9 [json_name = "notIn", (.buf.validate.priv.field) = { ... }- Returns:
- The count of notIn.
-
getNotIn
com.google.protobuf.ByteString getNotIn(int index) `not_in` requires the field value to be not equal to any of the specified values. If the field value matches any of the specified values, an error message is generated. ```proto message MyBytes { // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; } ```repeated bytes not_in = 9 [json_name = "notIn", (.buf.validate.priv.field) = { ... }- Parameters:
index- The index of the element to return.- Returns:
- The notIn at the given index.
-
hasIp
boolean hasIp()`ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format. If the field value doesn't meet this constraint, an error message is generated. ```proto message MyBytes { // value must be a valid IP address optional bytes value = 1 [(buf.validate.field).bytes.ip = true]; } ```bool ip = 10 [json_name = "ip", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the ip field is set.
-
getIp
boolean getIp()`ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format. If the field value doesn't meet this constraint, an error message is generated. ```proto message MyBytes { // value must be a valid IP address optional bytes value = 1 [(buf.validate.field).bytes.ip = true]; } ```bool ip = 10 [json_name = "ip", (.buf.validate.priv.field) = { ... }- Returns:
- The ip.
-
hasIpv4
boolean hasIpv4()`ipv4` ensures that the field `value` is a valid IPv4 address in byte format. If the field value doesn't meet this constraint, an error message is generated. ```proto message MyBytes { // value must be a valid IPv4 address optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true]; } ```bool ipv4 = 11 [json_name = "ipv4", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the ipv4 field is set.
-
getIpv4
boolean getIpv4()`ipv4` ensures that the field `value` is a valid IPv4 address in byte format. If the field value doesn't meet this constraint, an error message is generated. ```proto message MyBytes { // value must be a valid IPv4 address optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true]; } ```bool ipv4 = 11 [json_name = "ipv4", (.buf.validate.priv.field) = { ... }- Returns:
- The ipv4.
-
hasIpv6
boolean hasIpv6()`ipv6` ensures that the field `value` is a valid IPv6 address in byte format. If the field value doesn't meet this constraint, an error message is generated. ```proto message MyBytes { // value must be a valid IPv6 address optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true]; } ```bool ipv6 = 12 [json_name = "ipv6", (.buf.validate.priv.field) = { ... }- Returns:
- Whether the ipv6 field is set.
-
getIpv6
boolean getIpv6()`ipv6` ensures that the field `value` is a valid IPv6 address in byte format. If the field value doesn't meet this constraint, an error message is generated. ```proto message MyBytes { // value must be a valid IPv6 address optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true]; } ```bool ipv6 = 12 [json_name = "ipv6", (.buf.validate.priv.field) = { ... }- Returns:
- The ipv6.
-
getWellKnownCase
BytesRules.WellKnownCase getWellKnownCase()
-