@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.
|
public Iterator<SchemaLibrary.Problem> iterator()
iterator in interface Iterable<SchemaLibrary.Problem>public boolean hasProblems()
SchemaLibrary.ResultshasErrors() || hasWarnings()or
problemCount() != 0or
errorCount() != 0 || warningCount() != 0
hasProblems in interface SchemaLibrary.Resultstrue if there is at least one error or warning, or false if there are no errors or
warningspublic boolean hasErrors()
SchemaLibrary.ResultshasErrors in interface SchemaLibrary.Resultstrue if there is at least one error, or false if there are no errorspublic boolean hasWarnings()
SchemaLibrary.ResultshasWarnings in interface SchemaLibrary.Resultstrue if there is at least one warning, or false if there are no errorspublic boolean hasOnlyTypeMismatchErrors()
SchemaLibrary.Resultsmismatched 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.Resultstrue if there is at least one mismatched type error, or false if there are no errorsSchemaLibrary.convertValues(Document, Results)public int errorCount()
SchemaLibrary.ResultserrorCount in interface SchemaLibrary.Resultspublic int warningCount()
SchemaLibrary.ResultswarningCount in interface SchemaLibrary.Resultspublic int problemCount()
SchemaLibrary.ResultsproblemCount in interface SchemaLibrary.Resultspublic int successCount()
public void recordSuccess()
ProblemsrecordSuccess in interface Problemspublic void recordError(Path path, String reason)
ProblemsrecordError in interface Problemspath - the path; may not be nullreason - the message describing the error; may not be nullpublic void recordError(Path path, String reason, Throwable cause)
ProblemsrecordError in interface Problemspath - 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)
ProblemsrecordWarning in interface Problemspath - 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)
ProblemsrecordTypeMismatch in interface Problemspath - 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-2014 JBoss, a division of Red Hat. All Rights Reserved.