Package org.jibx.v2
Class ValidationContext
java.lang.Object
org.jibx.v2.ValidationContext
- All Implemented Interfaces:
ISkipElements
- Direct Known Subclasses:
SchemaValidationContext
Tracks the schema validation state. This includes order-dependent state information collected while walking the tree
structure of a schema model. Collects all errors and warnings and maintains a summary of the severity of the problems
found. For ease of use, this also wraps the schema name register with convenience methods for validation.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Flag for errors to be ignored.private int
Number of errors reported.private int
Number of fatals reported.private ArrayList
List of problem items reported by validation.private Set
Set of elements to be skipped in walking tree.private int
Number of warnings reported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Add error item.void
Add fatal item.void
addProblem
(ValidationProblem problem) Add problem report.protected void
Add element to set to be skipped.void
addWarning
(String msg, Object obj) Add warning item.int
Get number of error problems reported.int
Get number of fatal problems reported.Get list of problems.int
Get number of warning problems reported.void
boolean
Check if a component is being skipped due to a fatal error.
-
Field Details
-
m_warningCount
private int m_warningCountNumber of warnings reported. -
m_errorCount
private int m_errorCountNumber of errors reported. -
m_fatalCount
private int m_fatalCountNumber of fatals reported. -
m_problemList
List of problem items reported by validation. -
m_skipSet
Set of elements to be skipped in walking tree. -
m_continueOnError
private boolean m_continueOnErrorFlag for errors to be ignored.
-
-
Constructor Details
-
ValidationContext
public ValidationContext()Constructor.
-
-
Method Details
-
getWarningCount
public int getWarningCount()Get number of warning problems reported.- Returns:
- warning problem count
-
getErrorCount
public int getErrorCount()Get number of error problems reported.- Returns:
- error problem count
-
getFatalCount
public int getFatalCount()Get number of fatal problems reported.- Returns:
- fatal problem count
-
addWarning
Add warning item. Adds a warning item to the problem list, which is a possible problem that still allows reasonable operation.- Parameters:
msg
- problem descriptionobj
- source object for validation error- Throws:
JiBXException
- on unrecoverable error
-
addError
Add error item. Adds an error item to the problem list, which is a definite problem that still allows validation to proceed.- Parameters:
msg
- problem descriptionobj
- source object for validation error- Returns:
true
if to continue validation,false
if not- Throws:
JiBXException
- on unrecoverable error
-
addFatal
Add fatal item. Adds a fatal item to the problem list, which is a severe problem that blocks further validation within the tree branch involved. The object associated with a fatal error should always be an element.- Parameters:
msg
- problem descriptionobj
- source object for validation error (should be an element)- Throws:
JiBXException
- on unrecoverable error
-
addProblem
Add problem report. The problem is added and counted as appropriate.- Parameters:
problem
- details of problem report- Throws:
JiBXException
- on unrecoverable error
-
getProblems
Get list of problems.- Returns:
- problem list
-
addSkip
Add element to set to be skipped.- Parameters:
skip
-
-
isSkipped
Description copied from interface:ISkipElements
Check if a component is being skipped due to a fatal error.- Specified by:
isSkipped
in interfaceISkipElements
- Parameters:
obj
- component to be checked- Returns:
- flag for component being skipped
-
handleMissingElement
- Throws:
JiBXException
-