build.buf.validate.MapRules 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
The newest version!
// 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;
/**
*
* MapRules describe the constraints applied to `map` values.
*
*
* Protobuf type {@code buf.validate.MapRules}
*/
public final class MapRules extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:buf.validate.MapRules)
MapRulesOrBuilder {
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= */ "",
MapRules.class.getName());
}
// Use MapRules.newBuilder() to construct.
private MapRules(com.google.protobuf.GeneratedMessage.Builder builder) {
super(builder);
}
private MapRules() {
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_MapRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_MapRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.MapRules.class, build.buf.validate.MapRules.Builder.class);
}
private int bitField0_;
public static final int MIN_PAIRS_FIELD_NUMBER = 1;
private long minPairs_ = 0L;
/**
*
* Specifies the minimum number of key-value pairs allowed. If the field has
* fewer key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at least 2 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
* }
* ```
*
*
* optional uint64 min_pairs = 1 [json_name = "minPairs", (.buf.validate.priv.field) = { ... }
* @return Whether the minPairs field is set.
*/
@java.lang.Override
public boolean hasMinPairs() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
* Specifies the minimum number of key-value pairs allowed. If the field has
* fewer key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at least 2 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
* }
* ```
*
*
* optional uint64 min_pairs = 1 [json_name = "minPairs", (.buf.validate.priv.field) = { ... }
* @return The minPairs.
*/
@java.lang.Override
public long getMinPairs() {
return minPairs_;
}
public static final int MAX_PAIRS_FIELD_NUMBER = 2;
private long maxPairs_ = 0L;
/**
*
* Specifies the maximum number of key-value pairs allowed. If the field has
* more key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at most 3 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
* }
* ```
*
*
* optional uint64 max_pairs = 2 [json_name = "maxPairs", (.buf.validate.priv.field) = { ... }
* @return Whether the maxPairs field is set.
*/
@java.lang.Override
public boolean hasMaxPairs() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* Specifies the maximum number of key-value pairs allowed. If the field has
* more key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at most 3 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
* }
* ```
*
*
* optional uint64 max_pairs = 2 [json_name = "maxPairs", (.buf.validate.priv.field) = { ... }
* @return The maxPairs.
*/
@java.lang.Override
public long getMaxPairs() {
return maxPairs_;
}
public static final int KEYS_FIELD_NUMBER = 4;
private build.buf.validate.FieldConstraints keys_;
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
* @return Whether the keys field is set.
*/
@java.lang.Override
public boolean hasKeys() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
* @return The keys.
*/
@java.lang.Override
public build.buf.validate.FieldConstraints getKeys() {
return keys_ == null ? build.buf.validate.FieldConstraints.getDefaultInstance() : keys_;
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
@java.lang.Override
public build.buf.validate.FieldConstraintsOrBuilder getKeysOrBuilder() {
return keys_ == null ? build.buf.validate.FieldConstraints.getDefaultInstance() : keys_;
}
public static final int VALUES_FIELD_NUMBER = 5;
private build.buf.validate.FieldConstraints values_;
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
* @return Whether the values field is set.
*/
@java.lang.Override
public boolean hasValues() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
* @return The values.
*/
@java.lang.Override
public build.buf.validate.FieldConstraints getValues() {
return values_ == null ? build.buf.validate.FieldConstraints.getDefaultInstance() : values_;
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
@java.lang.Override
public build.buf.validate.FieldConstraintsOrBuilder getValuesOrBuilder() {
return values_ == null ? build.buf.validate.FieldConstraints.getDefaultInstance() : values_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (((bitField0_ & 0x00000001) != 0)) {
output.writeUInt64(1, minPairs_);
}
if (((bitField0_ & 0x00000002) != 0)) {
output.writeUInt64(2, maxPairs_);
}
if (((bitField0_ & 0x00000004) != 0)) {
output.writeMessage(4, getKeys());
}
if (((bitField0_ & 0x00000008) != 0)) {
output.writeMessage(5, getValues());
}
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
.computeUInt64Size(1, minPairs_);
}
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(2, maxPairs_);
}
if (((bitField0_ & 0x00000004) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, getKeys());
}
if (((bitField0_ & 0x00000008) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(5, getValues());
}
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.MapRules)) {
return super.equals(obj);
}
build.buf.validate.MapRules other = (build.buf.validate.MapRules) obj;
if (hasMinPairs() != other.hasMinPairs()) return false;
if (hasMinPairs()) {
if (getMinPairs()
!= other.getMinPairs()) return false;
}
if (hasMaxPairs() != other.hasMaxPairs()) return false;
if (hasMaxPairs()) {
if (getMaxPairs()
!= other.getMaxPairs()) return false;
}
if (hasKeys() != other.hasKeys()) return false;
if (hasKeys()) {
if (!getKeys()
.equals(other.getKeys())) return false;
}
if (hasValues() != other.hasValues()) return false;
if (hasValues()) {
if (!getValues()
.equals(other.getValues())) return false;
}
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasMinPairs()) {
hash = (37 * hash) + MIN_PAIRS_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getMinPairs());
}
if (hasMaxPairs()) {
hash = (37 * hash) + MAX_PAIRS_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getMaxPairs());
}
if (hasKeys()) {
hash = (37 * hash) + KEYS_FIELD_NUMBER;
hash = (53 * hash) + getKeys().hashCode();
}
if (hasValues()) {
hash = (37 * hash) + VALUES_FIELD_NUMBER;
hash = (53 * hash) + getValues().hashCode();
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static build.buf.validate.MapRules parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.MapRules 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.MapRules parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.MapRules 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.MapRules parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.MapRules parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static build.buf.validate.MapRules parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.MapRules 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.MapRules parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseDelimitedWithIOException(PARSER, input);
}
public static build.buf.validate.MapRules 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.MapRules parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.MapRules 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.MapRules 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;
}
/**
*
* MapRules describe the constraints applied to `map` values.
*
*
* Protobuf type {@code buf.validate.MapRules}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder implements
// @@protoc_insertion_point(builder_implements:buf.validate.MapRules)
build.buf.validate.MapRulesOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_MapRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_MapRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.MapRules.class, build.buf.validate.MapRules.Builder.class);
}
// Construct using build.buf.validate.MapRules.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage
.alwaysUseFieldBuilders) {
getKeysFieldBuilder();
getValuesFieldBuilder();
}
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
minPairs_ = 0L;
maxPairs_ = 0L;
keys_ = null;
if (keysBuilder_ != null) {
keysBuilder_.dispose();
keysBuilder_ = null;
}
values_ = null;
if (valuesBuilder_ != null) {
valuesBuilder_.dispose();
valuesBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_MapRules_descriptor;
}
@java.lang.Override
public build.buf.validate.MapRules getDefaultInstanceForType() {
return build.buf.validate.MapRules.getDefaultInstance();
}
@java.lang.Override
public build.buf.validate.MapRules build() {
build.buf.validate.MapRules result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public build.buf.validate.MapRules buildPartial() {
build.buf.validate.MapRules result = new build.buf.validate.MapRules(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(build.buf.validate.MapRules result) {
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.minPairs_ = minPairs_;
to_bitField0_ |= 0x00000001;
}
if (((from_bitField0_ & 0x00000002) != 0)) {
result.maxPairs_ = maxPairs_;
to_bitField0_ |= 0x00000002;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
result.keys_ = keysBuilder_ == null
? keys_
: keysBuilder_.build();
to_bitField0_ |= 0x00000004;
}
if (((from_bitField0_ & 0x00000008) != 0)) {
result.values_ = valuesBuilder_ == null
? values_
: valuesBuilder_.build();
to_bitField0_ |= 0x00000008;
}
result.bitField0_ |= to_bitField0_;
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof build.buf.validate.MapRules) {
return mergeFrom((build.buf.validate.MapRules)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(build.buf.validate.MapRules other) {
if (other == build.buf.validate.MapRules.getDefaultInstance()) return this;
if (other.hasMinPairs()) {
setMinPairs(other.getMinPairs());
}
if (other.hasMaxPairs()) {
setMaxPairs(other.getMaxPairs());
}
if (other.hasKeys()) {
mergeKeys(other.getKeys());
}
if (other.hasValues()) {
mergeValues(other.getValues());
}
this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
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 8: {
minPairs_ = input.readUInt64();
bitField0_ |= 0x00000001;
break;
} // case 8
case 16: {
maxPairs_ = input.readUInt64();
bitField0_ |= 0x00000002;
break;
} // case 16
case 34: {
input.readMessage(
getKeysFieldBuilder().getBuilder(),
extensionRegistry);
bitField0_ |= 0x00000004;
break;
} // case 34
case 42: {
input.readMessage(
getValuesFieldBuilder().getBuilder(),
extensionRegistry);
bitField0_ |= 0x00000008;
break;
} // case 42
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 bitField0_;
private long minPairs_ ;
/**
*
* Specifies the minimum number of key-value pairs allowed. If the field has
* fewer key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at least 2 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
* }
* ```
*
*
* optional uint64 min_pairs = 1 [json_name = "minPairs", (.buf.validate.priv.field) = { ... }
* @return Whether the minPairs field is set.
*/
@java.lang.Override
public boolean hasMinPairs() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
*
* Specifies the minimum number of key-value pairs allowed. If the field has
* fewer key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at least 2 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
* }
* ```
*
*
* optional uint64 min_pairs = 1 [json_name = "minPairs", (.buf.validate.priv.field) = { ... }
* @return The minPairs.
*/
@java.lang.Override
public long getMinPairs() {
return minPairs_;
}
/**
*
* Specifies the minimum number of key-value pairs allowed. If the field has
* fewer key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at least 2 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
* }
* ```
*
*
* optional uint64 min_pairs = 1 [json_name = "minPairs", (.buf.validate.priv.field) = { ... }
* @param value The minPairs to set.
* @return This builder for chaining.
*/
public Builder setMinPairs(long value) {
minPairs_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
* Specifies the minimum number of key-value pairs allowed. If the field has
* fewer key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at least 2 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.min_pairs = 2];
* }
* ```
*
*
* optional uint64 min_pairs = 1 [json_name = "minPairs", (.buf.validate.priv.field) = { ... }
* @return This builder for chaining.
*/
public Builder clearMinPairs() {
bitField0_ = (bitField0_ & ~0x00000001);
minPairs_ = 0L;
onChanged();
return this;
}
private long maxPairs_ ;
/**
*
* Specifies the maximum number of key-value pairs allowed. If the field has
* more key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at most 3 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
* }
* ```
*
*
* optional uint64 max_pairs = 2 [json_name = "maxPairs", (.buf.validate.priv.field) = { ... }
* @return Whether the maxPairs field is set.
*/
@java.lang.Override
public boolean hasMaxPairs() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* Specifies the maximum number of key-value pairs allowed. If the field has
* more key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at most 3 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
* }
* ```
*
*
* optional uint64 max_pairs = 2 [json_name = "maxPairs", (.buf.validate.priv.field) = { ... }
* @return The maxPairs.
*/
@java.lang.Override
public long getMaxPairs() {
return maxPairs_;
}
/**
*
* Specifies the maximum number of key-value pairs allowed. If the field has
* more key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at most 3 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
* }
* ```
*
*
* optional uint64 max_pairs = 2 [json_name = "maxPairs", (.buf.validate.priv.field) = { ... }
* @param value The maxPairs to set.
* @return This builder for chaining.
*/
public Builder setMaxPairs(long value) {
maxPairs_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
* Specifies the maximum number of key-value pairs allowed. If the field has
* more key-value pairs than specified, an error message is generated.
*
* ```proto
* message MyMap {
* // The field `value` must have at most 3 key-value pairs.
* map<string, string> value = 1 [(buf.validate.field).map.max_pairs = 3];
* }
* ```
*
*
* optional uint64 max_pairs = 2 [json_name = "maxPairs", (.buf.validate.priv.field) = { ... }
* @return This builder for chaining.
*/
public Builder clearMaxPairs() {
bitField0_ = (bitField0_ & ~0x00000002);
maxPairs_ = 0L;
onChanged();
return this;
}
private build.buf.validate.FieldConstraints keys_;
private com.google.protobuf.SingleFieldBuilder<
build.buf.validate.FieldConstraints, build.buf.validate.FieldConstraints.Builder, build.buf.validate.FieldConstraintsOrBuilder> keysBuilder_;
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
* @return Whether the keys field is set.
*/
public boolean hasKeys() {
return ((bitField0_ & 0x00000004) != 0);
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
* @return The keys.
*/
public build.buf.validate.FieldConstraints getKeys() {
if (keysBuilder_ == null) {
return keys_ == null ? build.buf.validate.FieldConstraints.getDefaultInstance() : keys_;
} else {
return keysBuilder_.getMessage();
}
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
public Builder setKeys(build.buf.validate.FieldConstraints value) {
if (keysBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
keys_ = value;
} else {
keysBuilder_.setMessage(value);
}
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
public Builder setKeys(
build.buf.validate.FieldConstraints.Builder builderForValue) {
if (keysBuilder_ == null) {
keys_ = builderForValue.build();
} else {
keysBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
public Builder mergeKeys(build.buf.validate.FieldConstraints value) {
if (keysBuilder_ == null) {
if (((bitField0_ & 0x00000004) != 0) &&
keys_ != null &&
keys_ != build.buf.validate.FieldConstraints.getDefaultInstance()) {
getKeysBuilder().mergeFrom(value);
} else {
keys_ = value;
}
} else {
keysBuilder_.mergeFrom(value);
}
if (keys_ != null) {
bitField0_ |= 0x00000004;
onChanged();
}
return this;
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
public Builder clearKeys() {
bitField0_ = (bitField0_ & ~0x00000004);
keys_ = null;
if (keysBuilder_ != null) {
keysBuilder_.dispose();
keysBuilder_ = null;
}
onChanged();
return this;
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
public build.buf.validate.FieldConstraints.Builder getKeysBuilder() {
bitField0_ |= 0x00000004;
onChanged();
return getKeysFieldBuilder().getBuilder();
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
public build.buf.validate.FieldConstraintsOrBuilder getKeysOrBuilder() {
if (keysBuilder_ != null) {
return keysBuilder_.getMessageOrBuilder();
} else {
return keys_ == null ?
build.buf.validate.FieldConstraints.getDefaultInstance() : keys_;
}
}
/**
*
* Specifies the constraints to be applied to each key in the field.
*
* ```proto
* message MyMap {
* // The keys in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.keys = {
* string: {
* min_len: 3
* max_len: 10
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints keys = 4 [json_name = "keys"];
*/
private com.google.protobuf.SingleFieldBuilder<
build.buf.validate.FieldConstraints, build.buf.validate.FieldConstraints.Builder, build.buf.validate.FieldConstraintsOrBuilder>
getKeysFieldBuilder() {
if (keysBuilder_ == null) {
keysBuilder_ = new com.google.protobuf.SingleFieldBuilder<
build.buf.validate.FieldConstraints, build.buf.validate.FieldConstraints.Builder, build.buf.validate.FieldConstraintsOrBuilder>(
getKeys(),
getParentForChildren(),
isClean());
keys_ = null;
}
return keysBuilder_;
}
private build.buf.validate.FieldConstraints values_;
private com.google.protobuf.SingleFieldBuilder<
build.buf.validate.FieldConstraints, build.buf.validate.FieldConstraints.Builder, build.buf.validate.FieldConstraintsOrBuilder> valuesBuilder_;
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
* @return Whether the values field is set.
*/
public boolean hasValues() {
return ((bitField0_ & 0x00000008) != 0);
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
* @return The values.
*/
public build.buf.validate.FieldConstraints getValues() {
if (valuesBuilder_ == null) {
return values_ == null ? build.buf.validate.FieldConstraints.getDefaultInstance() : values_;
} else {
return valuesBuilder_.getMessage();
}
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
public Builder setValues(build.buf.validate.FieldConstraints value) {
if (valuesBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
values_ = value;
} else {
valuesBuilder_.setMessage(value);
}
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
public Builder setValues(
build.buf.validate.FieldConstraints.Builder builderForValue) {
if (valuesBuilder_ == null) {
values_ = builderForValue.build();
} else {
valuesBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
public Builder mergeValues(build.buf.validate.FieldConstraints value) {
if (valuesBuilder_ == null) {
if (((bitField0_ & 0x00000008) != 0) &&
values_ != null &&
values_ != build.buf.validate.FieldConstraints.getDefaultInstance()) {
getValuesBuilder().mergeFrom(value);
} else {
values_ = value;
}
} else {
valuesBuilder_.mergeFrom(value);
}
if (values_ != null) {
bitField0_ |= 0x00000008;
onChanged();
}
return this;
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
public Builder clearValues() {
bitField0_ = (bitField0_ & ~0x00000008);
values_ = null;
if (valuesBuilder_ != null) {
valuesBuilder_.dispose();
valuesBuilder_ = null;
}
onChanged();
return this;
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
public build.buf.validate.FieldConstraints.Builder getValuesBuilder() {
bitField0_ |= 0x00000008;
onChanged();
return getValuesFieldBuilder().getBuilder();
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
public build.buf.validate.FieldConstraintsOrBuilder getValuesOrBuilder() {
if (valuesBuilder_ != null) {
return valuesBuilder_.getMessageOrBuilder();
} else {
return values_ == null ?
build.buf.validate.FieldConstraints.getDefaultInstance() : values_;
}
}
/**
*
* Specifies the constraints to be applied to the value of each key in the
* field. Message values will still have their validations evaluated unless
* skip is specified here.
*
* ```proto
* message MyMap {
* // The values in the field `value` must follow the specified constraints.
* map<string, string> value = 1 [(buf.validate.field).map.values = {
* string: {
* min_len: 5
* max_len: 20
* }
* }];
* }
* ```
*
*
* optional .buf.validate.FieldConstraints values = 5 [json_name = "values"];
*/
private com.google.protobuf.SingleFieldBuilder<
build.buf.validate.FieldConstraints, build.buf.validate.FieldConstraints.Builder, build.buf.validate.FieldConstraintsOrBuilder>
getValuesFieldBuilder() {
if (valuesBuilder_ == null) {
valuesBuilder_ = new com.google.protobuf.SingleFieldBuilder<
build.buf.validate.FieldConstraints, build.buf.validate.FieldConstraints.Builder, build.buf.validate.FieldConstraintsOrBuilder>(
getValues(),
getParentForChildren(),
isClean());
values_ = null;
}
return valuesBuilder_;
}
// @@protoc_insertion_point(builder_scope:buf.validate.MapRules)
}
// @@protoc_insertion_point(class_scope:buf.validate.MapRules)
private static final build.buf.validate.MapRules DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new build.buf.validate.MapRules();
}
public static build.buf.validate.MapRules getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public MapRules 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.MapRules getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}