Package build.buf.validate
Class Violation.Builder
java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
build.buf.validate.Violation.Builder
- All Implemented Interfaces:
ViolationOrBuilder,com.google.protobuf.Message.Builder,com.google.protobuf.MessageLite.Builder,com.google.protobuf.MessageLiteOrBuilder,com.google.protobuf.MessageOrBuilder,Cloneable
- Enclosing class:
- Violation
public static final class Violation.Builder
extends com.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
implements ViolationOrBuilder
`Violation` represents a single instance where a validation rule, expressed
as a `Constraint`, was not met. It provides information about the field that
caused the violation, the specific constraint that wasn't fulfilled, and a
human-readable error message.
```json
{
"fieldPath": "bar",
"constraintId": "foo.bar",
"message": "bar must be greater than 0"
}
```
Protobuf type buf.validate.Violation-
Method Summary
Modifier and TypeMethodDescriptionaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) build()clear()`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.clearField(com.google.protobuf.Descriptors.FieldDescriptor field) `field_path` is a machine-readable identifier that points to the specific field that failed the validation.`for_key` indicates whether the violation was caused by a map key, rather than a value.`message` is a human-readable error message that describes the nature of the violation.clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) clone()`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.com.google.protobuf.ByteString`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.static final com.google.protobuf.Descriptors.Descriptorcom.google.protobuf.Descriptors.Descriptor`field_path` is a machine-readable identifier that points to the specific field that failed the validation.com.google.protobuf.ByteString`field_path` is a machine-readable identifier that points to the specific field that failed the validation.boolean`for_key` indicates whether the violation was caused by a map key, rather than a value.`message` is a human-readable error message that describes the nature of the violation.com.google.protobuf.ByteString`message` is a human-readable error message that describes the nature of the violation.protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTablefinal booleanmergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) mergeFrom(com.google.protobuf.Message other) final Violation.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) setConstraintId(String value) `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.setConstraintIdBytes(com.google.protobuf.ByteString value) `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.setFieldPath(String value) `field_path` is a machine-readable identifier that points to the specific field that failed the validation.setFieldPathBytes(com.google.protobuf.ByteString value) `field_path` is a machine-readable identifier that points to the specific field that failed the validation.setForKey(boolean value) `for_key` indicates whether the violation was caused by a map key, rather than a value.setMessage(String value) `message` is a human-readable error message that describes the nature of the violation.setMessageBytes(com.google.protobuf.ByteString value) `message` is a human-readable error message that describes the nature of the violation.setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) final Violation.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<Violation.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<Violation.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<Violation.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<Violation.Builder>
-
setField
public Violation.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<Violation.Builder>
-
clearField
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
-
clearOneof
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
-
setRepeatedField
public Violation.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<Violation.Builder>
-
addRepeatedField
public Violation.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<Violation.Builder>
-
mergeFrom
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<Violation.Builder>
-
mergeFrom
-
isInitialized
public final boolean isInitialized()- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
-
mergeFrom
public Violation.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<Violation.Builder>- Throws:
IOException
-
getFieldPath
`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];- Specified by:
getFieldPathin interfaceViolationOrBuilder- Returns:
- The fieldPath.
-
getFieldPathBytes
public com.google.protobuf.ByteString getFieldPathBytes()`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];- Specified by:
getFieldPathBytesin interfaceViolationOrBuilder- Returns:
- The bytes for fieldPath.
-
setFieldPath
`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];- Parameters:
value- The fieldPath to set.- Returns:
- This builder for chaining.
-
clearFieldPath
`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];- Returns:
- This builder for chaining.
-
setFieldPathBytes
`field_path` is a machine-readable identifier that points to the specific field that failed the validation. This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
string field_path = 1 [json_name = "fieldPath"];- Parameters:
value- The bytes for fieldPath to set.- Returns:
- This builder for chaining.
-
getConstraintId
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];- Specified by:
getConstraintIdin interfaceViolationOrBuilder- Returns:
- The constraintId.
-
getConstraintIdBytes
public com.google.protobuf.ByteString getConstraintIdBytes()`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];- Specified by:
getConstraintIdBytesin interfaceViolationOrBuilder- Returns:
- The bytes for constraintId.
-
setConstraintId
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];- Parameters:
value- The constraintId to set.- Returns:
- This builder for chaining.
-
clearConstraintId
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];- Returns:
- This builder for chaining.
-
setConstraintIdBytes
`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled. This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
string constraint_id = 2 [json_name = "constraintId"];- Parameters:
value- The bytes for constraintId to set.- Returns:
- This builder for chaining.
-
getMessage
`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];- Specified by:
getMessagein interfaceViolationOrBuilder- Returns:
- The message.
-
getMessageBytes
public com.google.protobuf.ByteString getMessageBytes()`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];- Specified by:
getMessageBytesin interfaceViolationOrBuilder- Returns:
- The bytes for message.
-
setMessage
`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];- Parameters:
value- The message to set.- Returns:
- This builder for chaining.
-
clearMessage
`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];- Returns:
- This builder for chaining.
-
setMessageBytes
`message` is a human-readable error message that describes the nature of the violation. This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
string message = 3 [json_name = "message"];- Parameters:
value- The bytes for message to set.- Returns:
- This builder for chaining.
-
getForKey
public boolean getForKey()`for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4 [json_name = "forKey"];- Specified by:
getForKeyin interfaceViolationOrBuilder- Returns:
- The forKey.
-
setForKey
`for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4 [json_name = "forKey"];- Parameters:
value- The forKey to set.- Returns:
- This builder for chaining.
-
clearForKey
`for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4 [json_name = "forKey"];- Returns:
- This builder for chaining.
-
setUnknownFields
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
-
mergeUnknownFields
public final Violation.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields) - Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<Violation.Builder>
-