public class ValidationException extends RuntimeException
Schema subclasses on validation failure.| Constructor and Description |
|---|
ValidationException(Class<?> expectedType,
Object actualValue)
Deprecated.
|
ValidationException(Schema violatedSchema,
Class<?> expectedType,
Object actualValue)
Constructor.
|
ValidationException(Schema violatedSchema,
String message)
Constructor.
|
ValidationException(String message)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
List<ValidationException> |
getCausingExceptions() |
String |
getMessage() |
String |
getPointerToViolation()
A JSON pointer denoting the part of the document which violates the schema.
|
Schema |
getViolatedSchema() |
ValidationException |
prepend(String fragment)
Creates a new
ViolationException instance based on this one, but with changed
JSON pointer. |
ValidationException |
prepend(String fragment,
Schema violatedSchema)
Creates a new
ViolationException instance based on this one, but with changed
JSON pointer and {link violated
schema. |
static void |
throwFor(Schema rootFailingSchema,
List<ValidationException> failures)
Sort of static factory method.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString@Deprecated public ValidationException(Class<?> expectedType, Object actualValue)
ValidationException(Schema, Class<?>, Object) instead.expectedType - the expected typeactualValue - the violating valuepublic ValidationException(Schema violatedSchema, Class<?> expectedType, Object actualValue)
violatedSchema - the schema instance which detected the schema violationexpectedType - the expected typeactualValue - the violating valuepublic ValidationException(Schema violatedSchema, String message)
violatedSchema - the schema instance which detected the schema violationmessage - the readable exception message@Deprecated public ValidationException(String message)
ValidationException(Schema, String) instead.message - readable exception messagepublic static void throwFor(Schema rootFailingSchema, List<ValidationException> failures)
ObjectSchema and ArraySchema to
create ValidationExceptions, handling the case of multiple violations occuring during
validation.
failures is empty, then it doesn't do anythingfailures contains 1 exception instance, then that will be thrownviolated schema will be rootFailingSchema, and its causing exceptions will be the failures listrootFailingSchema - the schema which detected the failuresfailures - list containing validation failures to be thrown by this methodpublic List<ValidationException> getCausingExceptions()
public String getMessage()
getMessage in class Throwablepublic String getPointerToViolation()
#.public Schema getViolatedSchema()
public ValidationException prepend(String fragment)
ViolationException instance based on this one, but with changed
JSON pointer.fragment - the fragment of the JSON pointer to be prepended to existing pointerspublic ValidationException prepend(String fragment, Schema violatedSchema)
ViolationException instance based on this one, but with changed
JSON pointer and {link violated
schema.fragment - the fragment of the JSON pointer to be prepended to existing pointersviolatedSchema - the violated schema, which may not be the same as getViolatedSchema()ViolationException instanceCopyright © 2011–2016 Everit Kft.. All rights reserved.