build.buf.validate.BytesRules Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of protovalidate Show documentation
Show all versions of protovalidate Show documentation
Protocol Buffer Validation
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
// source: buf/validate/validate.proto
// Protobuf Java Version: 4.28.1
package build.buf.validate;
/**
*
* BytesRules describe the constraints applied to `bytes` values. These rules
* may also be applied to the `google.protobuf.BytesValue` Well-Known-Type.
*
*
* Protobuf type {@code buf.validate.BytesRules}
*/
public final class BytesRules extends
com.google.protobuf.GeneratedMessage.ExtendableMessage<
BytesRules> implements
// @@protoc_insertion_point(message_implements:buf.validate.BytesRules)
BytesRulesOrBuilder {
private static final long serialVersionUID = 0L;
static {
com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
/* major= */ 4,
/* minor= */ 28,
/* patch= */ 1,
/* suffix= */ "",
BytesRules.class.getName());
}
// Use BytesRules.newBuilder() to construct.
private BytesRules(com.google.protobuf.GeneratedMessage.ExtendableBuilder builder) {
super(builder);
}
private BytesRules() {
const_ = com.google.protobuf.ByteString.EMPTY;
pattern_ = "";
prefix_ = com.google.protobuf.ByteString.EMPTY;
suffix_ = com.google.protobuf.ByteString.EMPTY;
contains_ = com.google.protobuf.ByteString.EMPTY;
in_ = emptyList(com.google.protobuf.ByteString.class);
notIn_ = emptyList(com.google.protobuf.ByteString.class);
example_ = emptyList(com.google.protobuf.ByteString.class);
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BytesRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BytesRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.BytesRules.class, build.buf.validate.BytesRules.Builder.class);
}
private int bitField0_;
private int wellKnownCase_ = 0;
@SuppressWarnings("serial")
private java.lang.Object wellKnown_;
public enum WellKnownCase
implements com.google.protobuf.Internal.EnumLite,
com.google.protobuf.AbstractMessage.InternalOneOfEnum {
IP(10),
IPV4(11),
IPV6(12),
WELLKNOWN_NOT_SET(0);
private final int value;
private WellKnownCase(int value) {
this.value = value;
}
/**
* @param value The number of the enum to look for.
* @return The enum associated with the given number.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static WellKnownCase valueOf(int value) {
return forNumber(value);
}
public static WellKnownCase forNumber(int value) {
switch (value) {
case 10: return IP;
case 11: return IPV4;
case 12: return IPV6;
case 0: return WELLKNOWN_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public WellKnownCase
getWellKnownCase() {
return WellKnownCase.forNumber(
wellKnownCase_);
}
public static final int CONST_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString const_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the const field is set.
*/
@java.lang.Override
public boolean hasConst() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The const.
*/
@java.lang.Override
public com.google.protobuf.ByteString getConst() {
return const_;
}
public static final int LEN_FIELD_NUMBER = 13;
private long len_ = 0L;
/**
*
* `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.predefined) = { ... }
* @return Whether the len field is set.
*/
@java.lang.Override
public boolean hasLen() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The len.
*/
@java.lang.Override
public long getLen() {
return len_;
}
public static final int MIN_LEN_FIELD_NUMBER = 2;
private long minLen_ = 0L;
/**
*
* `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.predefined) = { ... }
* @return Whether the minLen field is set.
*/
@java.lang.Override
public boolean hasMinLen() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The minLen.
*/
@java.lang.Override
public long getMinLen() {
return minLen_;
}
public static final int MAX_LEN_FIELD_NUMBER = 3;
private long maxLen_ = 0L;
/**
*
* `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.predefined) = { ... }
* @return Whether the maxLen field is set.
*/
@java.lang.Override
public boolean hasMaxLen() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The maxLen.
*/
@java.lang.Override
public long getMaxLen() {
return maxLen_;
}
public static final int PATTERN_FIELD_NUMBER = 4;
@SuppressWarnings("serial")
private volatile java.lang.Object pattern_ = "";
/**
*
* `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.predefined) = { ... }
* @return Whether the pattern field is set.
*/
@java.lang.Override
public boolean hasPattern() {
return ((bitField0_ & 0x00000010) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The pattern.
*/
@java.lang.Override
public java.lang.String getPattern() {
java.lang.Object ref = pattern_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
pattern_ = s;
}
return s;
}
}
/**
*
* `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.predefined) = { ... }
* @return The bytes for pattern.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getPatternBytes() {
java.lang.Object ref = pattern_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
pattern_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PREFIX_FIELD_NUMBER = 5;
private com.google.protobuf.ByteString prefix_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the prefix field is set.
*/
@java.lang.Override
public boolean hasPrefix() {
return ((bitField0_ & 0x00000020) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The prefix.
*/
@java.lang.Override
public com.google.protobuf.ByteString getPrefix() {
return prefix_;
}
public static final int SUFFIX_FIELD_NUMBER = 6;
private com.google.protobuf.ByteString suffix_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the suffix field is set.
*/
@java.lang.Override
public boolean hasSuffix() {
return ((bitField0_ & 0x00000040) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The suffix.
*/
@java.lang.Override
public com.google.protobuf.ByteString getSuffix() {
return suffix_;
}
public static final int CONTAINS_FIELD_NUMBER = 7;
private com.google.protobuf.ByteString contains_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the contains field is set.
*/
@java.lang.Override
public boolean hasContains() {
return ((bitField0_ & 0x00000080) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The contains.
*/
@java.lang.Override
public com.google.protobuf.ByteString getContains() {
return contains_;
}
public static final int IN_FIELD_NUMBER = 8;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.ProtobufList in_ =
emptyList(com.google.protobuf.ByteString.class);
/**
*
* `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.predefined) = { ... }
* @return A list containing the in.
*/
@java.lang.Override
public java.util.List
getInList() {
return in_;
}
/**
*
* `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.predefined) = { ... }
* @return The count of in.
*/
public int getInCount() {
return in_.size();
}
/**
*
* `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.predefined) = { ... }
* @param index The index of the element to return.
* @return The in at the given index.
*/
public com.google.protobuf.ByteString getIn(int index) {
return in_.get(index);
}
public static final int NOT_IN_FIELD_NUMBER = 9;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.ProtobufList notIn_ =
emptyList(com.google.protobuf.ByteString.class);
/**
*
* `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.predefined) = { ... }
* @return A list containing the notIn.
*/
@java.lang.Override
public java.util.List
getNotInList() {
return notIn_;
}
/**
*
* `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.predefined) = { ... }
* @return The count of notIn.
*/
public int getNotInCount() {
return notIn_.size();
}
/**
*
* `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.predefined) = { ... }
* @param index The index of the element to return.
* @return The notIn at the given index.
*/
public com.google.protobuf.ByteString getNotIn(int index) {
return notIn_.get(index);
}
public static final int IP_FIELD_NUMBER = 10;
/**
*
* `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.predefined) = { ... }
* @return Whether the ip field is set.
*/
@java.lang.Override
public boolean hasIp() {
return wellKnownCase_ == 10;
}
/**
*
* `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.predefined) = { ... }
* @return The ip.
*/
@java.lang.Override
public boolean getIp() {
if (wellKnownCase_ == 10) {
return (java.lang.Boolean) wellKnown_;
}
return false;
}
public static final int IPV4_FIELD_NUMBER = 11;
/**
*
* `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.predefined) = { ... }
* @return Whether the ipv4 field is set.
*/
@java.lang.Override
public boolean hasIpv4() {
return wellKnownCase_ == 11;
}
/**
*
* `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.predefined) = { ... }
* @return The ipv4.
*/
@java.lang.Override
public boolean getIpv4() {
if (wellKnownCase_ == 11) {
return (java.lang.Boolean) wellKnown_;
}
return false;
}
public static final int IPV6_FIELD_NUMBER = 12;
/**
*
* `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.predefined) = { ... }
* @return Whether the ipv6 field is set.
*/
@java.lang.Override
public boolean hasIpv6() {
return wellKnownCase_ == 12;
}
/**
*
* `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.predefined) = { ... }
* @return The ipv6.
*/
@java.lang.Override
public boolean getIpv6() {
if (wellKnownCase_ == 12) {
return (java.lang.Boolean) wellKnown_;
}
return false;
}
public static final int EXAMPLE_FIELD_NUMBER = 14;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.ProtobufList example_ =
emptyList(com.google.protobuf.ByteString.class);
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @return A list containing the example.
*/
@java.lang.Override
public java.util.List
getExampleList() {
return example_;
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @return The count of example.
*/
public int getExampleCount() {
return example_.size();
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param index The index of the element to return.
* @return The example at the given index.
*/
public com.google.protobuf.ByteString getExample(int index) {
return example_.get(index);
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!extensionsAreInitialized()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
com.google.protobuf.GeneratedMessage
.ExtendableMessage.ExtensionSerializer
extensionWriter = newExtensionSerializer();
if (((bitField0_ & 0x00000001) != 0)) {
output.writeBytes(1, const_);
}
if (((bitField0_ & 0x00000004) != 0)) {
output.writeUInt64(2, minLen_);
}
if (((bitField0_ & 0x00000008) != 0)) {
output.writeUInt64(3, maxLen_);
}
if (((bitField0_ & 0x00000010) != 0)) {
com.google.protobuf.GeneratedMessage.writeString(output, 4, pattern_);
}
if (((bitField0_ & 0x00000020) != 0)) {
output.writeBytes(5, prefix_);
}
if (((bitField0_ & 0x00000040) != 0)) {
output.writeBytes(6, suffix_);
}
if (((bitField0_ & 0x00000080) != 0)) {
output.writeBytes(7, contains_);
}
for (int i = 0; i < in_.size(); i++) {
output.writeBytes(8, in_.get(i));
}
for (int i = 0; i < notIn_.size(); i++) {
output.writeBytes(9, notIn_.get(i));
}
if (wellKnownCase_ == 10) {
output.writeBool(
10, (boolean)((java.lang.Boolean) wellKnown_));
}
if (wellKnownCase_ == 11) {
output.writeBool(
11, (boolean)((java.lang.Boolean) wellKnown_));
}
if (wellKnownCase_ == 12) {
output.writeBool(
12, (boolean)((java.lang.Boolean) wellKnown_));
}
if (((bitField0_ & 0x00000002) != 0)) {
output.writeUInt64(13, len_);
}
for (int i = 0; i < example_.size(); i++) {
output.writeBytes(14, example_.get(i));
}
extensionWriter.writeUntil(536870912, output);
getUnknownFields().writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, const_);
}
if (((bitField0_ & 0x00000004) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(2, minLen_);
}
if (((bitField0_ & 0x00000008) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(3, maxLen_);
}
if (((bitField0_ & 0x00000010) != 0)) {
size += com.google.protobuf.GeneratedMessage.computeStringSize(4, pattern_);
}
if (((bitField0_ & 0x00000020) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(5, prefix_);
}
if (((bitField0_ & 0x00000040) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(6, suffix_);
}
if (((bitField0_ & 0x00000080) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(7, contains_);
}
{
int dataSize = 0;
for (int i = 0; i < in_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(in_.get(i));
}
size += dataSize;
size += 1 * getInList().size();
}
{
int dataSize = 0;
for (int i = 0; i < notIn_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(notIn_.get(i));
}
size += dataSize;
size += 1 * getNotInList().size();
}
if (wellKnownCase_ == 10) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(
10, (boolean)((java.lang.Boolean) wellKnown_));
}
if (wellKnownCase_ == 11) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(
11, (boolean)((java.lang.Boolean) wellKnown_));
}
if (wellKnownCase_ == 12) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(
12, (boolean)((java.lang.Boolean) wellKnown_));
}
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(13, len_);
}
{
int dataSize = 0;
for (int i = 0; i < example_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeBytesSizeNoTag(example_.get(i));
}
size += dataSize;
size += 1 * getExampleList().size();
}
size += extensionsSerializedSize();
size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof build.buf.validate.BytesRules)) {
return super.equals(obj);
}
build.buf.validate.BytesRules other = (build.buf.validate.BytesRules) obj;
if (hasConst() != other.hasConst()) return false;
if (hasConst()) {
if (!getConst()
.equals(other.getConst())) return false;
}
if (hasLen() != other.hasLen()) return false;
if (hasLen()) {
if (getLen()
!= other.getLen()) return false;
}
if (hasMinLen() != other.hasMinLen()) return false;
if (hasMinLen()) {
if (getMinLen()
!= other.getMinLen()) return false;
}
if (hasMaxLen() != other.hasMaxLen()) return false;
if (hasMaxLen()) {
if (getMaxLen()
!= other.getMaxLen()) return false;
}
if (hasPattern() != other.hasPattern()) return false;
if (hasPattern()) {
if (!getPattern()
.equals(other.getPattern())) return false;
}
if (hasPrefix() != other.hasPrefix()) return false;
if (hasPrefix()) {
if (!getPrefix()
.equals(other.getPrefix())) return false;
}
if (hasSuffix() != other.hasSuffix()) return false;
if (hasSuffix()) {
if (!getSuffix()
.equals(other.getSuffix())) return false;
}
if (hasContains() != other.hasContains()) return false;
if (hasContains()) {
if (!getContains()
.equals(other.getContains())) return false;
}
if (!getInList()
.equals(other.getInList())) return false;
if (!getNotInList()
.equals(other.getNotInList())) return false;
if (!getExampleList()
.equals(other.getExampleList())) return false;
if (!getWellKnownCase().equals(other.getWellKnownCase())) return false;
switch (wellKnownCase_) {
case 10:
if (getIp()
!= other.getIp()) return false;
break;
case 11:
if (getIpv4()
!= other.getIpv4()) return false;
break;
case 12:
if (getIpv6()
!= other.getIpv6()) return false;
break;
case 0:
default:
}
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
if (!getExtensionFields().equals(other.getExtensionFields()))
return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasConst()) {
hash = (37 * hash) + CONST_FIELD_NUMBER;
hash = (53 * hash) + getConst().hashCode();
}
if (hasLen()) {
hash = (37 * hash) + LEN_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getLen());
}
if (hasMinLen()) {
hash = (37 * hash) + MIN_LEN_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getMinLen());
}
if (hasMaxLen()) {
hash = (37 * hash) + MAX_LEN_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getMaxLen());
}
if (hasPattern()) {
hash = (37 * hash) + PATTERN_FIELD_NUMBER;
hash = (53 * hash) + getPattern().hashCode();
}
if (hasPrefix()) {
hash = (37 * hash) + PREFIX_FIELD_NUMBER;
hash = (53 * hash) + getPrefix().hashCode();
}
if (hasSuffix()) {
hash = (37 * hash) + SUFFIX_FIELD_NUMBER;
hash = (53 * hash) + getSuffix().hashCode();
}
if (hasContains()) {
hash = (37 * hash) + CONTAINS_FIELD_NUMBER;
hash = (53 * hash) + getContains().hashCode();
}
if (getInCount() > 0) {
hash = (37 * hash) + IN_FIELD_NUMBER;
hash = (53 * hash) + getInList().hashCode();
}
if (getNotInCount() > 0) {
hash = (37 * hash) + NOT_IN_FIELD_NUMBER;
hash = (53 * hash) + getNotInList().hashCode();
}
if (getExampleCount() > 0) {
hash = (37 * hash) + EXAMPLE_FIELD_NUMBER;
hash = (53 * hash) + getExampleList().hashCode();
}
switch (wellKnownCase_) {
case 10:
hash = (37 * hash) + IP_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIp());
break;
case 11:
hash = (37 * hash) + IPV4_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIpv4());
break;
case 12:
hash = (37 * hash) + IPV6_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getIpv6());
break;
case 0:
default:
}
hash = hashFields(hash, getExtensionFields());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static build.buf.validate.BytesRules parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.BytesRules parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static build.buf.validate.BytesRules parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.BytesRules parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static build.buf.validate.BytesRules parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.BytesRules parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static build.buf.validate.BytesRules parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.BytesRules parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static build.buf.validate.BytesRules parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseDelimitedWithIOException(PARSER, input);
}
public static build.buf.validate.BytesRules parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static build.buf.validate.BytesRules parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.BytesRules parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(build.buf.validate.BytesRules prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
* BytesRules describe the constraints applied to `bytes` values. These rules
* may also be applied to the `google.protobuf.BytesValue` Well-Known-Type.
*
*
* Protobuf type {@code buf.validate.BytesRules}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.ExtendableBuilder<
build.buf.validate.BytesRules, Builder> implements
// @@protoc_insertion_point(builder_implements:buf.validate.BytesRules)
build.buf.validate.BytesRulesOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BytesRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BytesRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.BytesRules.class, build.buf.validate.BytesRules.Builder.class);
}
// Construct using build.buf.validate.BytesRules.newBuilder()
private Builder() {
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
const_ = com.google.protobuf.ByteString.EMPTY;
len_ = 0L;
minLen_ = 0L;
maxLen_ = 0L;
pattern_ = "";
prefix_ = com.google.protobuf.ByteString.EMPTY;
suffix_ = com.google.protobuf.ByteString.EMPTY;
contains_ = com.google.protobuf.ByteString.EMPTY;
in_ = emptyList(com.google.protobuf.ByteString.class);
notIn_ = emptyList(com.google.protobuf.ByteString.class);
example_ = emptyList(com.google.protobuf.ByteString.class);
wellKnownCase_ = 0;
wellKnown_ = null;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BytesRules_descriptor;
}
@java.lang.Override
public build.buf.validate.BytesRules getDefaultInstanceForType() {
return build.buf.validate.BytesRules.getDefaultInstance();
}
@java.lang.Override
public build.buf.validate.BytesRules build() {
build.buf.validate.BytesRules result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public build.buf.validate.BytesRules buildPartial() {
build.buf.validate.BytesRules result = new build.buf.validate.BytesRules(this);
if (bitField0_ != 0) { buildPartial0(result); }
buildPartialOneofs(result);
onBuilt();
return result;
}
private void buildPartial0(build.buf.validate.BytesRules result) {
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.const_ = const_;
to_bitField0_ |= 0x00000001;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.len_ = len_;
to_bitField0_ |= 0x00000002;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.minLen_ = minLen_;
to_bitField0_ |= 0x00000004;
}
if (((from_bitField0_ & 0x00000008) != 0)) {
result.maxLen_ = maxLen_;
to_bitField0_ |= 0x00000008;
}
if (((from_bitField0_ & 0x00000010) != 0)) {
result.pattern_ = pattern_;
to_bitField0_ |= 0x00000010;
}
if (((from_bitField0_ & 0x00000020) != 0)) {
result.prefix_ = prefix_;
to_bitField0_ |= 0x00000020;
}
if (((from_bitField0_ & 0x00000040) != 0)) {
result.suffix_ = suffix_;
to_bitField0_ |= 0x00000040;
}
if (((from_bitField0_ & 0x00000080) != 0)) {
result.contains_ = contains_;
to_bitField0_ |= 0x00000080;
}
if (((from_bitField0_ & 0x00000100) != 0)) {
in_.makeImmutable();
result.in_ = in_;
}
if (((from_bitField0_ & 0x00000200) != 0)) {
notIn_.makeImmutable();
result.notIn_ = notIn_;
}
if (((from_bitField0_ & 0x00002000) != 0)) {
example_.makeImmutable();
result.example_ = example_;
}
result.bitField0_ |= to_bitField0_;
}
private void buildPartialOneofs(build.buf.validate.BytesRules result) {
result.wellKnownCase_ = wellKnownCase_;
result.wellKnown_ = this.wellKnown_;
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof build.buf.validate.BytesRules) {
return mergeFrom((build.buf.validate.BytesRules)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(build.buf.validate.BytesRules other) {
if (other == build.buf.validate.BytesRules.getDefaultInstance()) return this;
if (other.hasConst()) {
setConst(other.getConst());
}
if (other.hasLen()) {
setLen(other.getLen());
}
if (other.hasMinLen()) {
setMinLen(other.getMinLen());
}
if (other.hasMaxLen()) {
setMaxLen(other.getMaxLen());
}
if (other.hasPattern()) {
pattern_ = other.pattern_;
bitField0_ |= 0x00000010;
onChanged();
}
if (other.hasPrefix()) {
setPrefix(other.getPrefix());
}
if (other.hasSuffix()) {
setSuffix(other.getSuffix());
}
if (other.hasContains()) {
setContains(other.getContains());
}
if (!other.in_.isEmpty()) {
if (in_.isEmpty()) {
in_ = other.in_;
in_.makeImmutable();
bitField0_ |= 0x00000100;
} else {
ensureInIsMutable();
in_.addAll(other.in_);
}
onChanged();
}
if (!other.notIn_.isEmpty()) {
if (notIn_.isEmpty()) {
notIn_ = other.notIn_;
notIn_.makeImmutable();
bitField0_ |= 0x00000200;
} else {
ensureNotInIsMutable();
notIn_.addAll(other.notIn_);
}
onChanged();
}
if (!other.example_.isEmpty()) {
if (example_.isEmpty()) {
example_ = other.example_;
example_.makeImmutable();
bitField0_ |= 0x00002000;
} else {
ensureExampleIsMutable();
example_.addAll(other.example_);
}
onChanged();
}
switch (other.getWellKnownCase()) {
case IP: {
setIp(other.getIp());
break;
}
case IPV4: {
setIpv4(other.getIpv4());
break;
}
case IPV6: {
setIpv6(other.getIpv6());
break;
}
case WELLKNOWN_NOT_SET: {
break;
}
}
this.mergeExtensionFields(other);
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
if (!extensionsAreInitialized()) {
return false;
}
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
const_ = input.readBytes();
bitField0_ |= 0x00000001;
break;
} // case 10
case 16: {
minLen_ = input.readUInt64();
bitField0_ |= 0x00000004;
break;
} // case 16
case 24: {
maxLen_ = input.readUInt64();
bitField0_ |= 0x00000008;
break;
} // case 24
case 34: {
pattern_ = input.readBytes();
bitField0_ |= 0x00000010;
break;
} // case 34
case 42: {
prefix_ = input.readBytes();
bitField0_ |= 0x00000020;
break;
} // case 42
case 50: {
suffix_ = input.readBytes();
bitField0_ |= 0x00000040;
break;
} // case 50
case 58: {
contains_ = input.readBytes();
bitField0_ |= 0x00000080;
break;
} // case 58
case 66: {
com.google.protobuf.ByteString v = input.readBytes();
ensureInIsMutable();
in_.add(v);
break;
} // case 66
case 74: {
com.google.protobuf.ByteString v = input.readBytes();
ensureNotInIsMutable();
notIn_.add(v);
break;
} // case 74
case 80: {
wellKnown_ = input.readBool();
wellKnownCase_ = 10;
break;
} // case 80
case 88: {
wellKnown_ = input.readBool();
wellKnownCase_ = 11;
break;
} // case 88
case 96: {
wellKnown_ = input.readBool();
wellKnownCase_ = 12;
break;
} // case 96
case 104: {
len_ = input.readUInt64();
bitField0_ |= 0x00000002;
break;
} // case 104
case 114: {
com.google.protobuf.ByteString v = input.readBytes();
ensureExampleIsMutable();
example_.add(v);
break;
} // case 114
default: {
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
done = true; // was an endgroup tag
}
break;
} // default:
} // switch (tag)
} // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.unwrapIOException();
} finally {
onChanged();
} // finally
return this;
}
private int wellKnownCase_ = 0;
private java.lang.Object wellKnown_;
public WellKnownCase
getWellKnownCase() {
return WellKnownCase.forNumber(
wellKnownCase_);
}
public Builder clearWellKnown() {
wellKnownCase_ = 0;
wellKnown_ = null;
onChanged();
return this;
}
private int bitField0_;
private com.google.protobuf.ByteString const_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the const field is set.
*/
@java.lang.Override
public boolean hasConst() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The const.
*/
@java.lang.Override
public com.google.protobuf.ByteString getConst() {
return const_;
}
/**
*
* `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.predefined) = { ... }
* @param value The const to set.
* @return This builder for chaining.
*/
public Builder setConst(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
const_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearConst() {
bitField0_ = (bitField0_ & ~0x00000001);
const_ = getDefaultInstance().getConst();
onChanged();
return this;
}
private long len_ ;
/**
*
* `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.predefined) = { ... }
* @return Whether the len field is set.
*/
@java.lang.Override
public boolean hasLen() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The len.
*/
@java.lang.Override
public long getLen() {
return len_;
}
/**
*
* `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.predefined) = { ... }
* @param value The len to set.
* @return This builder for chaining.
*/
public Builder setLen(long value) {
len_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearLen() {
bitField0_ = (bitField0_ & ~0x00000002);
len_ = 0L;
onChanged();
return this;
}
private long minLen_ ;
/**
*
* `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.predefined) = { ... }
* @return Whether the minLen field is set.
*/
@java.lang.Override
public boolean hasMinLen() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The minLen.
*/
@java.lang.Override
public long getMinLen() {
return minLen_;
}
/**
*
* `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.predefined) = { ... }
* @param value The minLen to set.
* @return This builder for chaining.
*/
public Builder setMinLen(long value) {
minLen_ = value;
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearMinLen() {
bitField0_ = (bitField0_ & ~0x00000004);
minLen_ = 0L;
onChanged();
return this;
}
private long maxLen_ ;
/**
*
* `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.predefined) = { ... }
* @return Whether the maxLen field is set.
*/
@java.lang.Override
public boolean hasMaxLen() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The maxLen.
*/
@java.lang.Override
public long getMaxLen() {
return maxLen_;
}
/**
*
* `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.predefined) = { ... }
* @param value The maxLen to set.
* @return This builder for chaining.
*/
public Builder setMaxLen(long value) {
maxLen_ = value;
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearMaxLen() {
bitField0_ = (bitField0_ & ~0x00000008);
maxLen_ = 0L;
onChanged();
return this;
}
private java.lang.Object pattern_ = "";
/**
*
* `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.predefined) = { ... }
* @return Whether the pattern field is set.
*/
public boolean hasPattern() {
return ((bitField0_ & 0x00000010) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The pattern.
*/
public java.lang.String getPattern() {
java.lang.Object ref = pattern_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
pattern_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
* `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.predefined) = { ... }
* @return The bytes for pattern.
*/
public com.google.protobuf.ByteString
getPatternBytes() {
java.lang.Object ref = pattern_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
pattern_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
* `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.predefined) = { ... }
* @param value The pattern to set.
* @return This builder for chaining.
*/
public Builder setPattern(
java.lang.String value) {
if (value == null) { throw new NullPointerException(); }
pattern_ = value;
bitField0_ |= 0x00000010;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearPattern() {
pattern_ = getDefaultInstance().getPattern();
bitField0_ = (bitField0_ & ~0x00000010);
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @param value The bytes for pattern to set.
* @return This builder for chaining.
*/
public Builder setPatternBytes(
com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
pattern_ = value;
bitField0_ |= 0x00000010;
onChanged();
return this;
}
private com.google.protobuf.ByteString prefix_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the prefix field is set.
*/
@java.lang.Override
public boolean hasPrefix() {
return ((bitField0_ & 0x00000020) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The prefix.
*/
@java.lang.Override
public com.google.protobuf.ByteString getPrefix() {
return prefix_;
}
/**
*
* `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.predefined) = { ... }
* @param value The prefix to set.
* @return This builder for chaining.
*/
public Builder setPrefix(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
prefix_ = value;
bitField0_ |= 0x00000020;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearPrefix() {
bitField0_ = (bitField0_ & ~0x00000020);
prefix_ = getDefaultInstance().getPrefix();
onChanged();
return this;
}
private com.google.protobuf.ByteString suffix_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the suffix field is set.
*/
@java.lang.Override
public boolean hasSuffix() {
return ((bitField0_ & 0x00000040) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The suffix.
*/
@java.lang.Override
public com.google.protobuf.ByteString getSuffix() {
return suffix_;
}
/**
*
* `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.predefined) = { ... }
* @param value The suffix to set.
* @return This builder for chaining.
*/
public Builder setSuffix(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
suffix_ = value;
bitField0_ |= 0x00000040;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearSuffix() {
bitField0_ = (bitField0_ & ~0x00000040);
suffix_ = getDefaultInstance().getSuffix();
onChanged();
return this;
}
private com.google.protobuf.ByteString contains_ = com.google.protobuf.ByteString.EMPTY;
/**
*
* `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.predefined) = { ... }
* @return Whether the contains field is set.
*/
@java.lang.Override
public boolean hasContains() {
return ((bitField0_ & 0x00000080) != 0);
}
/**
*
* `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.predefined) = { ... }
* @return The contains.
*/
@java.lang.Override
public com.google.protobuf.ByteString getContains() {
return contains_;
}
/**
*
* `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.predefined) = { ... }
* @param value The contains to set.
* @return This builder for chaining.
*/
public Builder setContains(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
contains_ = value;
bitField0_ |= 0x00000080;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearContains() {
bitField0_ = (bitField0_ & ~0x00000080);
contains_ = getDefaultInstance().getContains();
onChanged();
return this;
}
private com.google.protobuf.Internal.ProtobufList in_ = emptyList(com.google.protobuf.ByteString.class);
private void ensureInIsMutable() {
if (!in_.isModifiable()) {
in_ = makeMutableCopy(in_);
}
bitField0_ |= 0x00000100;
}
/**
*
* `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.predefined) = { ... }
* @return A list containing the in.
*/
public java.util.List
getInList() {
in_.makeImmutable();
return in_;
}
/**
*
* `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.predefined) = { ... }
* @return The count of in.
*/
public int getInCount() {
return in_.size();
}
/**
*
* `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.predefined) = { ... }
* @param index The index of the element to return.
* @return The in at the given index.
*/
public com.google.protobuf.ByteString getIn(int index) {
return in_.get(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.predefined) = { ... }
* @param index The index to set the value at.
* @param value The in to set.
* @return This builder for chaining.
*/
public Builder setIn(
int index, com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
ensureInIsMutable();
in_.set(index, value);
bitField0_ |= 0x00000100;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @param value The in to add.
* @return This builder for chaining.
*/
public Builder addIn(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
ensureInIsMutable();
in_.add(value);
bitField0_ |= 0x00000100;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @param values The in to add.
* @return This builder for chaining.
*/
public Builder addAllIn(
java.lang.Iterable extends com.google.protobuf.ByteString> values) {
ensureInIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, in_);
bitField0_ |= 0x00000100;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearIn() {
in_ = emptyList(com.google.protobuf.ByteString.class);
bitField0_ = (bitField0_ & ~0x00000100);
onChanged();
return this;
}
private com.google.protobuf.Internal.ProtobufList notIn_ = emptyList(com.google.protobuf.ByteString.class);
private void ensureNotInIsMutable() {
if (!notIn_.isModifiable()) {
notIn_ = makeMutableCopy(notIn_);
}
bitField0_ |= 0x00000200;
}
/**
*
* `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.predefined) = { ... }
* @return A list containing the notIn.
*/
public java.util.List
getNotInList() {
notIn_.makeImmutable();
return notIn_;
}
/**
*
* `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.predefined) = { ... }
* @return The count of notIn.
*/
public int getNotInCount() {
return notIn_.size();
}
/**
*
* `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.predefined) = { ... }
* @param index The index of the element to return.
* @return The notIn at the given index.
*/
public com.google.protobuf.ByteString getNotIn(int index) {
return notIn_.get(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.predefined) = { ... }
* @param index The index to set the value at.
* @param value The notIn to set.
* @return This builder for chaining.
*/
public Builder setNotIn(
int index, com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
ensureNotInIsMutable();
notIn_.set(index, value);
bitField0_ |= 0x00000200;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @param value The notIn to add.
* @return This builder for chaining.
*/
public Builder addNotIn(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
ensureNotInIsMutable();
notIn_.add(value);
bitField0_ |= 0x00000200;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @param values The notIn to add.
* @return This builder for chaining.
*/
public Builder addAllNotIn(
java.lang.Iterable extends com.google.protobuf.ByteString> values) {
ensureNotInIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, notIn_);
bitField0_ |= 0x00000200;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearNotIn() {
notIn_ = emptyList(com.google.protobuf.ByteString.class);
bitField0_ = (bitField0_ & ~0x00000200);
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return Whether the ip field is set.
*/
public boolean hasIp() {
return wellKnownCase_ == 10;
}
/**
*
* `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.predefined) = { ... }
* @return The ip.
*/
public boolean getIp() {
if (wellKnownCase_ == 10) {
return (java.lang.Boolean) wellKnown_;
}
return false;
}
/**
*
* `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.predefined) = { ... }
* @param value The ip to set.
* @return This builder for chaining.
*/
public Builder setIp(boolean value) {
wellKnownCase_ = 10;
wellKnown_ = value;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearIp() {
if (wellKnownCase_ == 10) {
wellKnownCase_ = 0;
wellKnown_ = null;
onChanged();
}
return this;
}
/**
*
* `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.predefined) = { ... }
* @return Whether the ipv4 field is set.
*/
public boolean hasIpv4() {
return wellKnownCase_ == 11;
}
/**
*
* `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.predefined) = { ... }
* @return The ipv4.
*/
public boolean getIpv4() {
if (wellKnownCase_ == 11) {
return (java.lang.Boolean) wellKnown_;
}
return false;
}
/**
*
* `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.predefined) = { ... }
* @param value The ipv4 to set.
* @return This builder for chaining.
*/
public Builder setIpv4(boolean value) {
wellKnownCase_ = 11;
wellKnown_ = value;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearIpv4() {
if (wellKnownCase_ == 11) {
wellKnownCase_ = 0;
wellKnown_ = null;
onChanged();
}
return this;
}
/**
*
* `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.predefined) = { ... }
* @return Whether the ipv6 field is set.
*/
public boolean hasIpv6() {
return wellKnownCase_ == 12;
}
/**
*
* `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.predefined) = { ... }
* @return The ipv6.
*/
public boolean getIpv6() {
if (wellKnownCase_ == 12) {
return (java.lang.Boolean) wellKnown_;
}
return false;
}
/**
*
* `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.predefined) = { ... }
* @param value The ipv6 to set.
* @return This builder for chaining.
*/
public Builder setIpv6(boolean value) {
wellKnownCase_ = 12;
wellKnown_ = value;
onChanged();
return this;
}
/**
*
* `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.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearIpv6() {
if (wellKnownCase_ == 12) {
wellKnownCase_ = 0;
wellKnown_ = null;
onChanged();
}
return this;
}
private com.google.protobuf.Internal.ProtobufList example_ = emptyList(com.google.protobuf.ByteString.class);
private void ensureExampleIsMutable() {
if (!example_.isModifiable()) {
example_ = makeMutableCopy(example_);
}
bitField0_ |= 0x00002000;
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @return A list containing the example.
*/
public java.util.List
getExampleList() {
example_.makeImmutable();
return example_;
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @return The count of example.
*/
public int getExampleCount() {
return example_.size();
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param index The index of the element to return.
* @return The example at the given index.
*/
public com.google.protobuf.ByteString getExample(int index) {
return example_.get(index);
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param index The index to set the value at.
* @param value The example to set.
* @return This builder for chaining.
*/
public Builder setExample(
int index, com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
ensureExampleIsMutable();
example_.set(index, value);
bitField0_ |= 0x00002000;
onChanged();
return this;
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param value The example to add.
* @return This builder for chaining.
*/
public Builder addExample(com.google.protobuf.ByteString value) {
if (value == null) { throw new NullPointerException(); }
ensureExampleIsMutable();
example_.add(value);
bitField0_ |= 0x00002000;
onChanged();
return this;
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param values The example to add.
* @return This builder for chaining.
*/
public Builder addAllExample(
java.lang.Iterable extends com.google.protobuf.ByteString> values) {
ensureExampleIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, example_);
bitField0_ |= 0x00002000;
onChanged();
return this;
}
/**
*
* `example` specifies values that the field may have. These values SHOULD
* conform to other constraints. `example` values will not impact validation
* but may be used as helpful guidance on how to populate the given field.
*
* ```proto
* message MyBytes {
* bytes value = 1 [
* (buf.validate.field).bytes.example = "\x01\x02",
* (buf.validate.field).bytes.example = "\x02\x03"
* ];
* }
* ```
*
*
* repeated bytes example = 14 [json_name = "example", (.buf.validate.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearExample() {
example_ = emptyList(com.google.protobuf.ByteString.class);
bitField0_ = (bitField0_ & ~0x00002000);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:buf.validate.BytesRules)
}
// @@protoc_insertion_point(class_scope:buf.validate.BytesRules)
private static final build.buf.validate.BytesRules DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new build.buf.validate.BytesRules();
}
public static build.buf.validate.BytesRules getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public BytesRules parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
Builder builder = newBuilder();
try {
builder.mergeFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(builder.buildPartial());
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e)
.setUnfinishedMessage(builder.buildPartial());
}
return builder.buildPartial();
}
};
public static com.google.protobuf.Parser parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser getParserForType() {
return PARSER;
}
@java.lang.Override
public build.buf.validate.BytesRules getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}