@NotThreadSafe public class ValidationResult extends Object implements SchemaLibrary.Results, Problems
SchemaLibrary.Results
to which problems can be added.Constructor and Description |
---|
ValidationResult() |
Modifier and Type | Method and Description |
---|---|
void |
add(SchemaLibrary.Problem problem) |
void |
addAll(Iterable<SchemaLibrary.Problem> results) |
void |
addAll(Iterator<SchemaLibrary.Results> iter) |
int |
errorCount()
Determine the number of errors within these results.
|
boolean |
hasErrors()
Determine if these results contain at least one error.
|
boolean |
hasOnlyTypeMismatchErrors()
Determine if these results contain only errors that are
mismatched fields , where the
value of a field has a type that does not match but can be converted to the type defined in the schema. |
boolean |
hasProblems()
Determine if these results contain at least one error or warning.
|
boolean |
hasWarnings()
Determine if these results contain at least one warning.
|
Iterator<SchemaLibrary.Problem> |
iterator() |
int |
problemCount()
Determine the number of problems (that is, errors and warnings) within these results.
|
void |
recordError(Path path,
String reason)
Record an error at the given path in a document.
|
void |
recordError(Path path,
String reason,
Throwable cause)
Record an error at the given path in a document.
|
void |
recordIn(Problems otherProblems) |
void |
recordSuccess()
Record a successful validation.
|
void |
recordTypeMismatch(Path path,
String reason,
JsonSchema.Type actualType,
Object actualValue,
JsonSchema.Type requiredType,
Object convertedValue)
Record a field value was encountered whose type was not the expected type but could be converted to the expected type.
|
void |
recordWarning(Path path,
String reason)
Record a warning at the given path in a document.
|
int |
successCount() |
String |
toString() |
int |
warningCount()
Determine the number of warnings within these results.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Iterator<SchemaLibrary.Problem> iterator()
iterator
in interface Iterable<SchemaLibrary.Problem>
public boolean hasProblems()
SchemaLibrary.Results
hasErrors() || hasWarnings()or
problemCount() != 0or
errorCount() != 0 || warningCount() != 0
hasProblems
in interface SchemaLibrary.Results
true
if there is at least one error or warning, or false
if there are no errors or
warningspublic boolean hasErrors()
SchemaLibrary.Results
hasErrors
in interface SchemaLibrary.Results
true
if there is at least one error, or false
if there are no errorspublic boolean hasWarnings()
SchemaLibrary.Results
hasWarnings
in interface SchemaLibrary.Results
true
if there is at least one warning, or false
if there are no errorspublic boolean hasOnlyTypeMismatchErrors()
SchemaLibrary.Results
mismatched fields
, where the
value of a field has a type that does not match but can be converted to the type defined in the schema.
All type mismatch errors are considered errors
, but not all errors are type mismatch errors.
If this method return true, then consider calling SchemaLibrary.convertValues(Document, Results)
to convert the
mismatched values and then revalidating.
hasOnlyTypeMismatchErrors
in interface SchemaLibrary.Results
true
if there is at least one mismatched type error, or false
if there are no errorsSchemaLibrary.convertValues(Document, Results)
public int errorCount()
SchemaLibrary.Results
errorCount
in interface SchemaLibrary.Results
public int warningCount()
SchemaLibrary.Results
warningCount
in interface SchemaLibrary.Results
public int problemCount()
SchemaLibrary.Results
problemCount
in interface SchemaLibrary.Results
public int successCount()
public void recordSuccess()
Problems
recordSuccess
in interface Problems
public void recordError(Path path, String reason)
Problems
recordError
in interface Problems
path
- the path; may not be nullreason
- the message describing the error; may not be nullpublic void recordError(Path path, String reason, Throwable cause)
Problems
recordError
in interface Problems
path
- the path; may not be nullreason
- the message describing the error; may not be nullcause
- the exception that occurred and that is considered the causepublic void recordWarning(Path path, String reason)
Problems
recordWarning
in interface Problems
path
- the path; may not be nullreason
- the message describing the warning; may not be nullpublic void recordTypeMismatch(Path path, String reason, JsonSchema.Type actualType, Object actualValue, JsonSchema.Type requiredType, Object convertedValue)
Problems
recordTypeMismatch
in interface Problems
path
- the path; may not be nullreason
- the message describing the warning; may not be nullactualType
- the actual type of the field value; may not be nullactualValue
- the actual field valuerequiredType
- the expected type; may not be nullconvertedValue
- the converted valuepublic void recordIn(Problems otherProblems)
public void add(SchemaLibrary.Problem problem)
public void addAll(Iterable<SchemaLibrary.Problem> results)
public void addAll(Iterator<SchemaLibrary.Results> iter)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.