build.buf.validate.BoolRules 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;
/**
*
* BoolRules describes the constraints applied to `bool` values. These rules
* may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
*
*
* Protobuf type {@code buf.validate.BoolRules}
*/
public final class BoolRules extends
com.google.protobuf.GeneratedMessage.ExtendableMessage<
BoolRules> implements
// @@protoc_insertion_point(message_implements:buf.validate.BoolRules)
BoolRulesOrBuilder {
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= */ "",
BoolRules.class.getName());
}
// Use BoolRules.newBuilder() to construct.
private BoolRules(com.google.protobuf.GeneratedMessage.ExtendableBuilder builder) {
super(builder);
}
private BoolRules() {
example_ = emptyBooleanList();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BoolRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BoolRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.BoolRules.class, build.buf.validate.BoolRules.Builder.class);
}
private int bitField0_;
public static final int CONST_FIELD_NUMBER = 1;
private boolean const_ = false;
/**
*
* `const` requires the field value to exactly match the specified boolean value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* message MyBool {
* // value must equal true
* bool value = 1 [(buf.validate.field).bool.const = true];
* }
* ```
*
*
* optional bool 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 boolean value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* message MyBool {
* // value must equal true
* bool value = 1 [(buf.validate.field).bool.const = true];
* }
* ```
*
*
* optional bool const = 1 [json_name = "const", (.buf.validate.predefined) = { ... }
* @return The const.
*/
@java.lang.Override
public boolean getConst() {
return const_;
}
public static final int EXAMPLE_FIELD_NUMBER = 2;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.BooleanList example_ =
emptyBooleanList();
/**
*
* `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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param index The index of the element to return.
* @return The example at the given index.
*/
public boolean getExample(int index) {
return example_.getBoolean(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.writeBool(1, const_);
}
for (int i = 0; i < example_.size(); i++) {
output.writeBool(2, example_.getBoolean(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
.computeBoolSize(1, const_);
}
{
int dataSize = 0;
dataSize = 1 * getExampleList().size();
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.BoolRules)) {
return super.equals(obj);
}
build.buf.validate.BoolRules other = (build.buf.validate.BoolRules) obj;
if (hasConst() != other.hasConst()) return false;
if (hasConst()) {
if (getConst()
!= other.getConst()) return false;
}
if (!getExampleList()
.equals(other.getExampleList())) return false;
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) + com.google.protobuf.Internal.hashBoolean(
getConst());
}
if (getExampleCount() > 0) {
hash = (37 * hash) + EXAMPLE_FIELD_NUMBER;
hash = (53 * hash) + getExampleList().hashCode();
}
hash = hashFields(hash, getExtensionFields());
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static build.buf.validate.BoolRules parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.BoolRules 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.BoolRules parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.BoolRules 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.BoolRules parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.BoolRules parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static build.buf.validate.BoolRules parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.BoolRules 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.BoolRules parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseDelimitedWithIOException(PARSER, input);
}
public static build.buf.validate.BoolRules 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.BoolRules parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.BoolRules 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.BoolRules 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;
}
/**
*
* BoolRules describes the constraints applied to `bool` values. These rules
* may also be applied to the `google.protobuf.BoolValue` Well-Known-Type.
*
*
* Protobuf type {@code buf.validate.BoolRules}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.ExtendableBuilder<
build.buf.validate.BoolRules, Builder> implements
// @@protoc_insertion_point(builder_implements:buf.validate.BoolRules)
build.buf.validate.BoolRulesOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BoolRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BoolRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.BoolRules.class, build.buf.validate.BoolRules.Builder.class);
}
// Construct using build.buf.validate.BoolRules.newBuilder()
private Builder() {
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
const_ = false;
example_ = emptyBooleanList();
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_BoolRules_descriptor;
}
@java.lang.Override
public build.buf.validate.BoolRules getDefaultInstanceForType() {
return build.buf.validate.BoolRules.getDefaultInstance();
}
@java.lang.Override
public build.buf.validate.BoolRules build() {
build.buf.validate.BoolRules result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public build.buf.validate.BoolRules buildPartial() {
build.buf.validate.BoolRules result = new build.buf.validate.BoolRules(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(build.buf.validate.BoolRules 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)) {
example_.makeImmutable();
result.example_ = example_;
}
result.bitField0_ |= to_bitField0_;
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof build.buf.validate.BoolRules) {
return mergeFrom((build.buf.validate.BoolRules)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(build.buf.validate.BoolRules other) {
if (other == build.buf.validate.BoolRules.getDefaultInstance()) return this;
if (other.hasConst()) {
setConst(other.getConst());
}
if (!other.example_.isEmpty()) {
if (example_.isEmpty()) {
example_ = other.example_;
example_.makeImmutable();
bitField0_ |= 0x00000002;
} else {
ensureExampleIsMutable();
example_.addAll(other.example_);
}
onChanged();
}
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 8: {
const_ = input.readBool();
bitField0_ |= 0x00000001;
break;
} // case 8
case 16: {
boolean v = input.readBool();
ensureExampleIsMutable();
example_.addBoolean(v);
break;
} // case 16
case 18: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
int alloc = length > 4096 ? 4096 : length;
ensureExampleIsMutable(alloc / 1);
while (input.getBytesUntilLimit() > 0) {
example_.addBoolean(input.readBool());
}
input.popLimit(limit);
break;
} // case 18
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 boolean const_ ;
/**
*
* `const` requires the field value to exactly match the specified boolean value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* message MyBool {
* // value must equal true
* bool value = 1 [(buf.validate.field).bool.const = true];
* }
* ```
*
*
* optional bool 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 boolean value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* message MyBool {
* // value must equal true
* bool value = 1 [(buf.validate.field).bool.const = true];
* }
* ```
*
*
* optional bool const = 1 [json_name = "const", (.buf.validate.predefined) = { ... }
* @return The const.
*/
@java.lang.Override
public boolean getConst() {
return const_;
}
/**
*
* `const` requires the field value to exactly match the specified boolean value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* message MyBool {
* // value must equal true
* bool value = 1 [(buf.validate.field).bool.const = true];
* }
* ```
*
*
* optional bool const = 1 [json_name = "const", (.buf.validate.predefined) = { ... }
* @param value The const to set.
* @return This builder for chaining.
*/
public Builder setConst(boolean value) {
const_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
* `const` requires the field value to exactly match the specified boolean value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* message MyBool {
* // value must equal true
* bool value = 1 [(buf.validate.field).bool.const = true];
* }
* ```
*
*
* optional bool const = 1 [json_name = "const", (.buf.validate.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearConst() {
bitField0_ = (bitField0_ & ~0x00000001);
const_ = false;
onChanged();
return this;
}
private com.google.protobuf.Internal.BooleanList example_ = emptyBooleanList();
private void ensureExampleIsMutable() {
if (!example_.isModifiable()) {
example_ = makeMutableCopy(example_);
}
bitField0_ |= 0x00000002;
}
private void ensureExampleIsMutable(int capacity) {
if (!example_.isModifiable()) {
example_ = makeMutableCopy(example_, capacity);
}
bitField0_ |= 0x00000002;
}
/**
*
* `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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param index The index of the element to return.
* @return The example at the given index.
*/
public boolean getExample(int index) {
return example_.getBoolean(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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [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, boolean value) {
ensureExampleIsMutable();
example_.setBoolean(index, value);
bitField0_ |= 0x00000002;
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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param value The example to add.
* @return This builder for chaining.
*/
public Builder addExample(boolean value) {
ensureExampleIsMutable();
example_.addBoolean(value);
bitField0_ |= 0x00000002;
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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [json_name = "example", (.buf.validate.predefined) = { ... }
* @param values The example to add.
* @return This builder for chaining.
*/
public Builder addAllExample(
java.lang.Iterable values) {
ensureExampleIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, example_);
bitField0_ |= 0x00000002;
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 MyBool {
* bool value = 1 [
* (buf.validate.field).bool.example = 1,
* (buf.validate.field).bool.example = 2
* ];
* }
* ```
*
*
* repeated bool example = 2 [json_name = "example", (.buf.validate.predefined) = { ... }
* @return This builder for chaining.
*/
public Builder clearExample() {
example_ = emptyBooleanList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:buf.validate.BoolRules)
}
// @@protoc_insertion_point(class_scope:buf.validate.BoolRules)
private static final build.buf.validate.BoolRules DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new build.buf.validate.BoolRules();
}
public static build.buf.validate.BoolRules getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public BoolRules 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.BoolRules getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}