Package build.buf.validate
Class Violation.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderT>
-
- com.google.protobuf.GeneratedMessage.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,java.lang.Cloneable
- Enclosing class:
- Violation
public static final class Violation.Builder extends com.google.protobuf.GeneratedMessage.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 typebuf.validate.Violation
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Violationbuild()ViolationbuildPartial()Violation.Builderclear()Violation.BuilderclearConstraintId()`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.Violation.BuilderclearFieldPath()`field_path` is a machine-readable identifier that points to the specific field that failed the validation.Violation.BuilderclearForKey()`for_key` indicates whether the violation was caused by a map key, rather than a value.Violation.BuilderclearMessage()`message` is a human-readable error message that describes the nature of the violation.java.lang.StringgetConstraintId()`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.com.google.protobuf.ByteStringgetConstraintIdBytes()`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.ViolationgetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()java.lang.StringgetFieldPath()`field_path` is a machine-readable identifier that points to the specific field that failed the validation.com.google.protobuf.ByteStringgetFieldPathBytes()`field_path` is a machine-readable identifier that points to the specific field that failed the validation.booleangetForKey()`for_key` indicates whether the violation was caused by a map key, rather than a value.java.lang.StringgetMessage()`message` is a human-readable error message that describes the nature of the violation.com.google.protobuf.ByteStringgetMessageBytes()`message` is a human-readable error message that describes the nature of the violation.protected com.google.protobuf.GeneratedMessage.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()Violation.BuildermergeFrom(Violation other)Violation.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)Violation.BuildermergeFrom(com.google.protobuf.Message other)Violation.BuildersetConstraintId(java.lang.String value)`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.Violation.BuildersetConstraintIdBytes(com.google.protobuf.ByteString value)`constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.Violation.BuildersetFieldPath(java.lang.String value)`field_path` is a machine-readable identifier that points to the specific field that failed the validation.Violation.BuildersetFieldPathBytes(com.google.protobuf.ByteString value)`field_path` is a machine-readable identifier that points to the specific field that failed the validation.Violation.BuildersetForKey(boolean value)`for_key` indicates whether the violation was caused by a map key, rather than a value.Violation.BuildersetMessage(java.lang.String value)`message` is a human-readable error message that describes the nature of the violation.Violation.BuildersetMessageBytes(com.google.protobuf.ByteString value)`message` is a human-readable error message that describes the nature of the violation.-
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<Violation.Builder>
-
clear
public Violation.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<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.GeneratedMessage.Builder<Violation.Builder>
-
getDefaultInstanceForType
public Violation getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public Violation build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public Violation buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
mergeFrom
public Violation.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<Violation.Builder>
-
mergeFrom
public Violation.Builder mergeFrom(Violation other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.google.protobuf.GeneratedMessage.Builder<Violation.Builder>
-
mergeFrom
public Violation.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<Violation.Builder>- Throws:
java.io.IOException
-
getFieldPath
public java.lang.String 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;- 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;- Specified by:
getFieldPathBytesin interfaceViolationOrBuilder- Returns:
- The bytes for fieldPath.
-
setFieldPath
public Violation.Builder setFieldPath(java.lang.String value)
`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;- Parameters:
value- The fieldPath to set.- Returns:
- This builder for chaining.
-
clearFieldPath
public Violation.Builder 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;- Returns:
- This builder for chaining.
-
setFieldPathBytes
public Violation.Builder setFieldPathBytes(com.google.protobuf.ByteString value)
`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;- Parameters:
value- The bytes for fieldPath to set.- Returns:
- This builder for chaining.
-
getConstraintId
public java.lang.String 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;- 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;- Specified by:
getConstraintIdBytesin interfaceViolationOrBuilder- Returns:
- The bytes for constraintId.
-
setConstraintId
public Violation.Builder setConstraintId(java.lang.String value)
`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;- Parameters:
value- The constraintId to set.- Returns:
- This builder for chaining.
-
clearConstraintId
public Violation.Builder 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;- Returns:
- This builder for chaining.
-
setConstraintIdBytes
public Violation.Builder setConstraintIdBytes(com.google.protobuf.ByteString value)
`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;- Parameters:
value- The bytes for constraintId to set.- Returns:
- This builder for chaining.
-
getMessage
public java.lang.String 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;- 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;- Specified by:
getMessageBytesin interfaceViolationOrBuilder- Returns:
- The bytes for message.
-
setMessage
public Violation.Builder setMessage(java.lang.String value)
`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;- Parameters:
value- The message to set.- Returns:
- This builder for chaining.
-
clearMessage
public Violation.Builder 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;- Returns:
- This builder for chaining.
-
setMessageBytes
public Violation.Builder setMessageBytes(com.google.protobuf.ByteString value)
`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;- 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;- Specified by:
getForKeyin interfaceViolationOrBuilder- Returns:
- The forKey.
-
setForKey
public Violation.Builder setForKey(boolean value)
`for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4;- Parameters:
value- The forKey to set.- Returns:
- This builder for chaining.
-
clearForKey
public Violation.Builder clearForKey()
`for_key` indicates whether the violation was caused by a map key, rather than a value.
bool for_key = 4;- Returns:
- This builder for chaining.
-
-