Package build.buf.validate
Class EnumRules.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
build.buf.validate.EnumRules.Builder
- All Implemented Interfaces:
EnumRulesOrBuilder,com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Cloneable
- Enclosing class:
- EnumRules
public static final class EnumRules.Builder
extends com.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
implements EnumRulesOrBuilder
EnumRules describe the constraints applied to `enum` values.Protobuf type
buf.validate.EnumRules-
Method Summary
Modifier and TypeMethodDescription`in` requires the field value to be equal to one of the specified enum values.addAllNotIn(Iterable<? extends Integer> values) `not_in` requires the field value to be not equal to any of the specified enum values.addIn(int value) `in` requires the field value to be equal to one of the specified enum values.addNotIn(int value) `not_in` requires the field value to be not equal to any of the specified enum values.addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()`const` requires the field value to exactly match the specified enum value.`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.clearField(com.google.protobuf.Descriptors.FieldDescriptor field) clearIn()`in` requires the field value to be equal to one of the specified enum values.`not_in` requires the field value to be not equal to any of the specified enum values.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) clone()intgetConst()`const` requires the field value to exactly match the specified enum value.boolean`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.DescriptorintgetIn(int index) `in` requires the field value to be equal to one of the specified enum values.int`in` requires the field value to be equal to one of the specified enum values.`in` requires the field value to be equal to one of the specified enum values.intgetNotIn(int index) `not_in` requires the field value to be not equal to any of the specified enum values.int`not_in` requires the field value to be not equal to any of the specified enum values.`not_in` requires the field value to be not equal to any of the specified enum values.booleanhasConst()`const` requires the field value to exactly match the specified enum value.boolean`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal booleanmergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) final EnumRules.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setConst(int value) `const` requires the field value to exactly match the specified enum value.setDefinedOnly(boolean value) `defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.setIn(int index, int value) `in` requires the field value to be equal to one of the specified enum values.setNotIn(int index, int value) `not_in` requires the field value to be not equal to any of the specified enum values.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) final EnumRules.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringMethods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageExceptionMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.protobuf.Message.Builder
mergeDelimitedFrom, mergeDelimitedFromMethods inherited from interface com.google.protobuf.MessageLite.Builder
mergeFromMethods inherited from interface com.google.protobuf.MessageOrBuilder
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
-
Method Details
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() -
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
clear
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
getDefaultInstanceForType
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
setField
public EnumRules.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
clearField
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
clearOneof
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
setRepeatedField
public EnumRules.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) - Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
addRepeatedField
public EnumRules.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) - Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<EnumRules.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
mergeFrom
public EnumRules.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException - Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<EnumRules.Builder>- Throws:
IOException
-
hasConst
public boolean hasConst()`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) = { ... }- Specified by:
hasConstin interfaceEnumRulesOrBuilder- Returns:
- Whether the const field is set.
-
getConst
public int getConst()`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) = { ... }- Specified by:
getConstin interfaceEnumRulesOrBuilder- Returns:
- The const.
-
setConst
`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) = { ... }- Parameters:
value- The const to set.- Returns:
- This builder for chaining.
-
clearConst
`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) = { ... }- Returns:
- This builder for chaining.
-
hasDefinedOnly
public boolean hasDefinedOnly()`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"];- Specified by:
hasDefinedOnlyin interfaceEnumRulesOrBuilder- Returns:
- Whether the definedOnly field is set.
-
getDefinedOnly
public boolean getDefinedOnly()`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"];- Specified by:
getDefinedOnlyin interfaceEnumRulesOrBuilder- Returns:
- The definedOnly.
-
setDefinedOnly
`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"];- Parameters:
value- The definedOnly to set.- Returns:
- This builder for chaining.
-
clearDefinedOnly
`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"];- Returns:
- This builder for chaining.
-
getInList
`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) = { ... }- Specified by:
getInListin interfaceEnumRulesOrBuilder- Returns:
- A list containing the in.
-
getInCount
public int getInCount()`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) = { ... }- Specified by:
getInCountin interfaceEnumRulesOrBuilder- Returns:
- The count of in.
-
getIn
public int getIn(int 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) = { ... }- Specified by:
getInin interfaceEnumRulesOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The in at the given index.
-
setIn
`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) = { ... }- Parameters:
index- The index to set the value at.value- The in to set.- Returns:
- This builder for chaining.
-
addIn
`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) = { ... }- Parameters:
value- The in to add.- Returns:
- This builder for chaining.
-
addAllIn
`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) = { ... }- Parameters:
values- The in to add.- Returns:
- This builder for chaining.
-
clearIn
`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) = { ... }- Returns:
- This builder for chaining.
-
getNotInList
`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) = { ... }- Specified by:
getNotInListin interfaceEnumRulesOrBuilder- Returns:
- A list containing the notIn.
-
getNotInCount
public int getNotInCount()`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) = { ... }- Specified by:
getNotInCountin interfaceEnumRulesOrBuilder- Returns:
- The count of notIn.
-
getNotIn
public int getNotIn(int 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) = { ... }- Specified by:
getNotInin interfaceEnumRulesOrBuilder- Parameters:
index- The index of the element to return.- Returns:
- The notIn at the given index.
-
setNotIn
`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) = { ... }- Parameters:
index- The index to set the value at.value- The notIn to set.- Returns:
- This builder for chaining.
-
addNotIn
`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) = { ... }- Parameters:
value- The notIn to add.- Returns:
- This builder for chaining.
-
addAllNotIn
`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) = { ... }- Parameters:
values- The notIn to add.- Returns:
- This builder for chaining.
-
clearNotIn
`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) = { ... }- Returns:
- This builder for chaining.
-
setUnknownFields
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-
mergeUnknownFields
public final EnumRules.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<EnumRules.Builder>
-