build.buf.validate.EnumRules 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;
/**
*
* EnumRules describe the constraints applied to `enum` values.
*
*
* Protobuf type {@code buf.validate.EnumRules}
*/
public final class EnumRules extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:buf.validate.EnumRules)
EnumRulesOrBuilder {
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= */ "",
EnumRules.class.getName());
}
// Use EnumRules.newBuilder() to construct.
private EnumRules(com.google.protobuf.GeneratedMessage.Builder builder) {
super(builder);
}
private EnumRules() {
in_ = emptyIntList();
notIn_ = emptyIntList();
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_EnumRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_EnumRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.EnumRules.class, build.buf.validate.EnumRules.Builder.class);
}
private int bitField0_;
public static final int CONST_FIELD_NUMBER = 1;
private int const_ = 0;
/**
*
* `const` requires the field value to exactly match the specified enum value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be exactly MY_ENUM_VALUE1.
* MyEnum value = 1 [(buf.validate.field).enum.const = 1];
* }
* ```
*
*
* optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
* @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 enum value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be exactly MY_ENUM_VALUE1.
* MyEnum value = 1 [(buf.validate.field).enum.const = 1];
* }
* ```
*
*
* optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
* @return The const.
*/
@java.lang.Override
public int getConst() {
return const_;
}
public static final int DEFINED_ONLY_FIELD_NUMBER = 2;
private boolean definedOnly_ = false;
/**
*
* `defined_only` requires the field value to be one of the defined values for
* this enum, failing on any undefined value.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be a defined value of MyEnum.
* MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
* }
* ```
*
*
* optional bool defined_only = 2 [json_name = "definedOnly"];
* @return Whether the definedOnly field is set.
*/
@java.lang.Override
public boolean hasDefinedOnly() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* `defined_only` requires the field value to be one of the defined values for
* this enum, failing on any undefined value.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be a defined value of MyEnum.
* MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
* }
* ```
*
*
* optional bool defined_only = 2 [json_name = "definedOnly"];
* @return The definedOnly.
*/
@java.lang.Override
public boolean getDefinedOnly() {
return definedOnly_;
}
public static final int IN_FIELD_NUMBER = 3;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.IntList in_ =
emptyIntList();
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @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 enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @return The count of in.
*/
public int getInCount() {
return in_.size();
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @param index The index of the element to return.
* @return The in at the given index.
*/
public int getIn(int index) {
return in_.getInt(index);
}
private int inMemoizedSerializedSize = -1;
public static final int NOT_IN_FIELD_NUMBER = 4;
@SuppressWarnings("serial")
private com.google.protobuf.Internal.IntList notIn_ =
emptyIntList();
/**
*
* `not_in` requires the field value to be not equal to any of the
* specified enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @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 enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @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 enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @param index The index of the element to return.
* @return The notIn at the given index.
*/
public int getNotIn(int index) {
return notIn_.getInt(index);
}
private int notInMemoizedSerializedSize = -1;
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 {
getSerializedSize();
if (((bitField0_ & 0x00000001) != 0)) {
output.writeInt32(1, const_);
}
if (((bitField0_ & 0x00000002) != 0)) {
output.writeBool(2, definedOnly_);
}
if (getInList().size() > 0) {
output.writeUInt32NoTag(26);
output.writeUInt32NoTag(inMemoizedSerializedSize);
}
for (int i = 0; i < in_.size(); i++) {
output.writeInt32NoTag(in_.getInt(i));
}
if (getNotInList().size() > 0) {
output.writeUInt32NoTag(34);
output.writeUInt32NoTag(notInMemoizedSerializedSize);
}
for (int i = 0; i < notIn_.size(); i++) {
output.writeInt32NoTag(notIn_.getInt(i));
}
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
.computeInt32Size(1, const_);
}
if (((bitField0_ & 0x00000002) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(2, definedOnly_);
}
{
int dataSize = 0;
for (int i = 0; i < in_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(in_.getInt(i));
}
size += dataSize;
if (!getInList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
inMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
for (int i = 0; i < notIn_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(notIn_.getInt(i));
}
size += dataSize;
if (!getNotInList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
notInMemoizedSerializedSize = dataSize;
}
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.EnumRules)) {
return super.equals(obj);
}
build.buf.validate.EnumRules other = (build.buf.validate.EnumRules) obj;
if (hasConst() != other.hasConst()) return false;
if (hasConst()) {
if (getConst()
!= other.getConst()) return false;
}
if (hasDefinedOnly() != other.hasDefinedOnly()) return false;
if (hasDefinedOnly()) {
if (getDefinedOnly()
!= other.getDefinedOnly()) return false;
}
if (!getInList()
.equals(other.getInList())) return false;
if (!getNotInList()
.equals(other.getNotInList())) 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 (hasConst()) {
hash = (37 * hash) + CONST_FIELD_NUMBER;
hash = (53 * hash) + getConst();
}
if (hasDefinedOnly()) {
hash = (37 * hash) + DEFINED_ONLY_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
getDefinedOnly());
}
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();
}
hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
public static build.buf.validate.EnumRules parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.EnumRules 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.EnumRules parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.EnumRules 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.EnumRules parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static build.buf.validate.EnumRules parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static build.buf.validate.EnumRules parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.EnumRules 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.EnumRules parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseDelimitedWithIOException(PARSER, input);
}
public static build.buf.validate.EnumRules 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.EnumRules parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessage
.parseWithIOException(PARSER, input);
}
public static build.buf.validate.EnumRules 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.EnumRules 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;
}
/**
*
* EnumRules describe the constraints applied to `enum` values.
*
*
* Protobuf type {@code buf.validate.EnumRules}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder implements
// @@protoc_insertion_point(builder_implements:buf.validate.EnumRules)
build.buf.validate.EnumRulesOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_EnumRules_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_EnumRules_fieldAccessorTable
.ensureFieldAccessorsInitialized(
build.buf.validate.EnumRules.class, build.buf.validate.EnumRules.Builder.class);
}
// Construct using build.buf.validate.EnumRules.newBuilder()
private Builder() {
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
}
@java.lang.Override
public Builder clear() {
super.clear();
bitField0_ = 0;
const_ = 0;
definedOnly_ = false;
in_ = emptyIntList();
notIn_ = emptyIntList();
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return build.buf.validate.ValidateProto.internal_static_buf_validate_EnumRules_descriptor;
}
@java.lang.Override
public build.buf.validate.EnumRules getDefaultInstanceForType() {
return build.buf.validate.EnumRules.getDefaultInstance();
}
@java.lang.Override
public build.buf.validate.EnumRules build() {
build.buf.validate.EnumRules result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public build.buf.validate.EnumRules buildPartial() {
build.buf.validate.EnumRules result = new build.buf.validate.EnumRules(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
private void buildPartial0(build.buf.validate.EnumRules 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.definedOnly_ = definedOnly_;
to_bitField0_ |= 0x00000002;
}
if (((from_bitField0_ & 0x00000004) != 0)) {
in_.makeImmutable();
result.in_ = in_;
}
if (((from_bitField0_ & 0x00000008) != 0)) {
notIn_.makeImmutable();
result.notIn_ = notIn_;
}
result.bitField0_ |= to_bitField0_;
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof build.buf.validate.EnumRules) {
return mergeFrom((build.buf.validate.EnumRules)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(build.buf.validate.EnumRules other) {
if (other == build.buf.validate.EnumRules.getDefaultInstance()) return this;
if (other.hasConst()) {
setConst(other.getConst());
}
if (other.hasDefinedOnly()) {
setDefinedOnly(other.getDefinedOnly());
}
if (!other.in_.isEmpty()) {
if (in_.isEmpty()) {
in_ = other.in_;
in_.makeImmutable();
bitField0_ |= 0x00000004;
} else {
ensureInIsMutable();
in_.addAll(other.in_);
}
onChanged();
}
if (!other.notIn_.isEmpty()) {
if (notIn_.isEmpty()) {
notIn_ = other.notIn_;
notIn_.makeImmutable();
bitField0_ |= 0x00000008;
} else {
ensureNotInIsMutable();
notIn_.addAll(other.notIn_);
}
onChanged();
}
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: {
const_ = input.readInt32();
bitField0_ |= 0x00000001;
break;
} // case 8
case 16: {
definedOnly_ = input.readBool();
bitField0_ |= 0x00000002;
break;
} // case 16
case 24: {
int v = input.readInt32();
ensureInIsMutable();
in_.addInt(v);
break;
} // case 24
case 26: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
ensureInIsMutable();
while (input.getBytesUntilLimit() > 0) {
in_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
} // case 26
case 32: {
int v = input.readInt32();
ensureNotInIsMutable();
notIn_.addInt(v);
break;
} // case 32
case 34: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
ensureNotInIsMutable();
while (input.getBytesUntilLimit() > 0) {
notIn_.addInt(input.readInt32());
}
input.popLimit(limit);
break;
} // case 34
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 int const_ ;
/**
*
* `const` requires the field value to exactly match the specified enum value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be exactly MY_ENUM_VALUE1.
* MyEnum value = 1 [(buf.validate.field).enum.const = 1];
* }
* ```
*
*
* optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
* @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 enum value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be exactly MY_ENUM_VALUE1.
* MyEnum value = 1 [(buf.validate.field).enum.const = 1];
* }
* ```
*
*
* optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
* @return The const.
*/
@java.lang.Override
public int getConst() {
return const_;
}
/**
*
* `const` requires the field value to exactly match the specified enum value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be exactly MY_ENUM_VALUE1.
* MyEnum value = 1 [(buf.validate.field).enum.const = 1];
* }
* ```
*
*
* optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
* @param value The const to set.
* @return This builder for chaining.
*/
public Builder setConst(int value) {
const_ = value;
bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
*
* `const` requires the field value to exactly match the specified enum value.
* If the field value doesn't match, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be exactly MY_ENUM_VALUE1.
* MyEnum value = 1 [(buf.validate.field).enum.const = 1];
* }
* ```
*
*
* optional int32 const = 1 [json_name = "const", (.buf.validate.priv.field) = { ... }
* @return This builder for chaining.
*/
public Builder clearConst() {
bitField0_ = (bitField0_ & ~0x00000001);
const_ = 0;
onChanged();
return this;
}
private boolean definedOnly_ ;
/**
*
* `defined_only` requires the field value to be one of the defined values for
* this enum, failing on any undefined value.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be a defined value of MyEnum.
* MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
* }
* ```
*
*
* optional bool defined_only = 2 [json_name = "definedOnly"];
* @return Whether the definedOnly field is set.
*/
@java.lang.Override
public boolean hasDefinedOnly() {
return ((bitField0_ & 0x00000002) != 0);
}
/**
*
* `defined_only` requires the field value to be one of the defined values for
* this enum, failing on any undefined value.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be a defined value of MyEnum.
* MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
* }
* ```
*
*
* optional bool defined_only = 2 [json_name = "definedOnly"];
* @return The definedOnly.
*/
@java.lang.Override
public boolean getDefinedOnly() {
return definedOnly_;
}
/**
*
* `defined_only` requires the field value to be one of the defined values for
* this enum, failing on any undefined value.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be a defined value of MyEnum.
* MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
* }
* ```
*
*
* optional bool defined_only = 2 [json_name = "definedOnly"];
* @param value The definedOnly to set.
* @return This builder for chaining.
*/
public Builder setDefinedOnly(boolean value) {
definedOnly_ = value;
bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
*
* `defined_only` requires the field value to be one of the defined values for
* this enum, failing on any undefined value.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be a defined value of MyEnum.
* MyEnum value = 1 [(buf.validate.field).enum.defined_only = true];
* }
* ```
*
*
* optional bool defined_only = 2 [json_name = "definedOnly"];
* @return This builder for chaining.
*/
public Builder clearDefinedOnly() {
bitField0_ = (bitField0_ & ~0x00000002);
definedOnly_ = false;
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList in_ = emptyIntList();
private void ensureInIsMutable() {
if (!in_.isModifiable()) {
in_ = makeMutableCopy(in_);
}
bitField0_ |= 0x00000004;
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @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 enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @return The count of in.
*/
public int getInCount() {
return in_.size();
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @param index The index of the element to return.
* @return The in at the given index.
*/
public int getIn(int index) {
return in_.getInt(index);
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @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, int value) {
ensureInIsMutable();
in_.setInt(index, value);
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @param value The in to add.
* @return This builder for chaining.
*/
public Builder addIn(int value) {
ensureInIsMutable();
in_.addInt(value);
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @param values The in to add.
* @return This builder for chaining.
*/
public Builder addAllIn(
java.lang.Iterable values) {
ensureInIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, in_);
bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
*
* `in` requires the field value to be equal to one of the
* specified enum values. If the field value doesn't match any of the
* specified values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must be equal to one of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}];
* }
* ```
*
*
* repeated int32 in = 3 [json_name = "in", (.buf.validate.priv.field) = { ... }
* @return This builder for chaining.
*/
public Builder clearIn() {
in_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
private com.google.protobuf.Internal.IntList notIn_ = emptyIntList();
private void ensureNotInIsMutable() {
if (!notIn_.isModifiable()) {
notIn_ = makeMutableCopy(notIn_);
}
bitField0_ |= 0x00000008;
}
/**
*
* `not_in` requires the field value to be not equal to any of the
* specified enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @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 enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @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 enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @param index The index of the element to return.
* @return The notIn at the given index.
*/
public int getNotIn(int index) {
return notIn_.getInt(index);
}
/**
*
* `not_in` requires the field value to be not equal to any of the
* specified enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @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, int value) {
ensureNotInIsMutable();
notIn_.setInt(index, value);
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* `not_in` requires the field value to be not equal to any of the
* specified enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @param value The notIn to add.
* @return This builder for chaining.
*/
public Builder addNotIn(int value) {
ensureNotInIsMutable();
notIn_.addInt(value);
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* `not_in` requires the field value to be not equal to any of the
* specified enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @param values The notIn to add.
* @return This builder for chaining.
*/
public Builder addAllNotIn(
java.lang.Iterable values) {
ensureNotInIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, notIn_);
bitField0_ |= 0x00000008;
onChanged();
return this;
}
/**
*
* `not_in` requires the field value to be not equal to any of the
* specified enum values. If the field value matches one of the specified
* values, an error message is generated.
*
* ```proto
* enum MyEnum {
* MY_ENUM_UNSPECIFIED = 0;
* MY_ENUM_VALUE1 = 1;
* MY_ENUM_VALUE2 = 2;
* }
*
* message MyMessage {
* // The field `value` must not be equal to any of the specified values.
* MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}];
* }
* ```
*
*
* repeated int32 not_in = 4 [json_name = "notIn", (.buf.validate.priv.field) = { ... }
* @return This builder for chaining.
*/
public Builder clearNotIn() {
notIn_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:buf.validate.EnumRules)
}
// @@protoc_insertion_point(class_scope:buf.validate.EnumRules)
private static final build.buf.validate.EnumRules DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new build.buf.validate.EnumRules();
}
public static build.buf.validate.EnumRules getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser
PARSER = new com.google.protobuf.AbstractParser() {
@java.lang.Override
public EnumRules 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.EnumRules getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}