Package build.buf.validate
Class EnumRules.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderT>
-
- com.google.protobuf.GeneratedMessage.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,java.lang.Cloneable
- Enclosing class:
- EnumRules
public static final class EnumRules.Builder extends com.google.protobuf.GeneratedMessage.Builder<EnumRules.Builder> implements EnumRulesOrBuilder
EnumRules describe the constraints applied to `enum` values.
Protobuf typebuf.validate.EnumRules
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EnumRules.BuilderaddAllIn(java.lang.Iterable<? extends java.lang.Integer> values)`in` requires the field value to be equal to one of the specified enum values.EnumRules.BuilderaddAllNotIn(java.lang.Iterable<? extends java.lang.Integer> values)`not_in` requires the field value to be not equal to any of the specified enum values.EnumRules.BuilderaddIn(int value)`in` requires the field value to be equal to one of the specified enum values.EnumRules.BuilderaddNotIn(int value)`not_in` requires the field value to be not equal to any of the specified enum values.EnumRulesbuild()EnumRulesbuildPartial()EnumRules.Builderclear()EnumRules.BuilderclearConst()`const` requires the field value to exactly match the specified enum value.EnumRules.BuilderclearDefinedOnly()`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.EnumRules.BuilderclearIn()`in` requires the field value to be equal to one of the specified enum values.EnumRules.BuilderclearNotIn()`not_in` requires the field value to be not equal to any of the specified enum values.intgetConst()`const` requires the field value to exactly match the specified enum value.EnumRulesgetDefaultInstanceForType()booleangetDefinedOnly()`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()intgetIn(int index)`in` requires the field value to be equal to one of the specified enum values.intgetInCount()`in` requires the field value to be equal to one of the specified enum values.java.util.List<java.lang.Integer>getInList()`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.intgetNotInCount()`not_in` requires the field value to be not equal to any of the specified enum values.java.util.List<java.lang.Integer>getNotInList()`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.booleanhasDefinedOnly()`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.GeneratedMessage.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()EnumRules.BuildermergeFrom(EnumRules other)EnumRules.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)EnumRules.BuildermergeFrom(com.google.protobuf.Message other)EnumRules.BuildersetConst(int value)`const` requires the field value to exactly match the specified enum value.EnumRules.BuildersetDefinedOnly(boolean value)`defined_only` requires the field value to be one of the defined values for this enum, failing on any undefined value.EnumRules.BuildersetIn(int index, int value)`in` requires the field value to be equal to one of the specified enum values.EnumRules.BuildersetNotIn(int index, int value)`not_in` requires the field value to be not equal to any of the specified enum values.-
Methods inherited from class com.google.protobuf.GeneratedMessage.Builder
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownFields, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedField, setUnknownFields, setUnknownFieldSetBuilder, setUnknownFieldsProto3
-
Methods inherited from class com.google.protobuf.AbstractMessage.Builder
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
-
Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder
addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessage.Builder<EnumRules.Builder>
-
clear
public EnumRules.Builder clear()
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessage.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.GeneratedMessage.Builder<EnumRules.Builder>
-
getDefaultInstanceForType
public EnumRules getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public EnumRules build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public EnumRules buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
mergeFrom
public EnumRules.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<EnumRules.Builder>
-
mergeFrom
public EnumRules.Builder mergeFrom(EnumRules other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessage.Builder<EnumRules.Builder>
-
mergeFrom
public EnumRules.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.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:
java.io.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 [(.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 [(.buf.validate.priv.field) = { ... }- Specified by:
getConstin interfaceEnumRulesOrBuilder- Returns:
- The const.
-
setConst
public EnumRules.Builder setConst(int value)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
value- The const to set.- Returns:
- This builder for chaining.
-
clearConst
public EnumRules.Builder 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 [(.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;- 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;- Specified by:
getDefinedOnlyin interfaceEnumRulesOrBuilder- Returns:
- The definedOnly.
-
setDefinedOnly
public EnumRules.Builder setDefinedOnly(boolean value)
`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;- Parameters:
value- The definedOnly to set.- Returns:
- This builder for chaining.
-
clearDefinedOnly
public EnumRules.Builder 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;- Returns:
- This builder for chaining.
-
getInList
public java.util.List<java.lang.Integer> 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 [(.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 [(.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 [(.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
public EnumRules.Builder setIn(int index, int value)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
index- The index to set the value at.value- The in to set.- Returns:
- This builder for chaining.
-
addIn
public EnumRules.Builder addIn(int value)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
value- The in to add.- Returns:
- This builder for chaining.
-
addAllIn
public EnumRules.Builder addAllIn(java.lang.Iterable<? extends java.lang.Integer> values)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
values- The in to add.- Returns:
- This builder for chaining.
-
clearIn
public EnumRules.Builder 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 [(.buf.validate.priv.field) = { ... }- Returns:
- This builder for chaining.
-
getNotInList
public java.util.List<java.lang.Integer> 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 [(.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 [(.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 [(.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
public EnumRules.Builder setNotIn(int index, int value)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
index- The index to set the value at.value- The notIn to set.- Returns:
- This builder for chaining.
-
addNotIn
public EnumRules.Builder addNotIn(int value)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
value- The notIn to add.- Returns:
- This builder for chaining.
-
addAllNotIn
public EnumRules.Builder addAllNotIn(java.lang.Iterable<? extends java.lang.Integer> values)
`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 [(.buf.validate.priv.field) = { ... }- Parameters:
values- The notIn to add.- Returns:
- This builder for chaining.
-
clearNotIn
public EnumRules.Builder 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 [(.buf.validate.priv.field) = { ... }- Returns:
- This builder for chaining.
-
-