@NotThreadSafe public class PSValidationHandlerBreakOnFirstError extends AbstractPSPartialValidationHandler
IPSValidationHandler
that stops validation
upon the first error (the first failed assert or the first successful
report). The final validation result can be retrieved by invoking
getValidity()
.Constructor and Description |
---|
PSValidationHandlerBreakOnFirstError() |
Modifier and Type | Method and Description |
---|---|
com.helger.commons.state.EValidity |
getValidity() |
com.helger.commons.state.EContinue |
onFailedAssert(PSAssertReport aAssertReport,
String sTestExpression,
Node aRuleMatchingNode,
int nNodeIndex,
Object aContext)
This method is called for every failed assert.
|
com.helger.commons.state.EContinue |
onSuccessfulReport(PSAssertReport aAssertReport,
String sTestExpression,
Node aRuleMatchingNode,
int nNodeIndex,
Object aContext)
This method is called for every failed assert.
|
onEnd, onPattern, onRule, onStart
public PSValidationHandlerBreakOnFirstError()
@Nonnull public com.helger.commons.state.EContinue onFailedAssert(@Nonnull PSAssertReport aAssertReport, @Nonnull String sTestExpression, @Nonnull Node aRuleMatchingNode, int nNodeIndex, @Nullable Object aContext)
IPSValidationHandler
onFailedAssert
in interface IPSValidationHandler
onFailedAssert
in class PSValidationHandlerDefault
aAssertReport
- The current assert element. Never null
.sTestExpression
- The source XPath expression that was evaluated for this node. It may
be different from the test expression contained in the passed
assert/report element because of replaced <let> elements.
Never null
.aRuleMatchingNode
- The XML node of the document to be validated.nNodeIndex
- The index of the matched node, relative to the current rule.aContext
- A context object - implementation dependent. For the default query
binding this is e.g. an
PSXPathBoundAssertReport
object.EContinue.BREAK
to stop validating immediately.@Nonnull public com.helger.commons.state.EContinue onSuccessfulReport(@Nonnull PSAssertReport aAssertReport, @Nonnull String sTestExpression, @Nonnull Node aRuleMatchingNode, int nNodeIndex, @Nullable Object aContext)
IPSValidationHandler
onSuccessfulReport
in interface IPSValidationHandler
onSuccessfulReport
in class PSValidationHandlerDefault
aAssertReport
- The current assert element. Never null
.sTestExpression
- The source XPath expression that was evaluated for this node. It may
be different from the test expression contained in the passed
assert/report element because of replaced <let> elements.
Never null
.aRuleMatchingNode
- The XML node of the document to be validated.nNodeIndex
- The index of the matched node, relative to the current rule.aContext
- A context object - implementation dependent. For the default query
binding this is e.g. an
PSXPathBoundAssertReport
object.EContinue.BREAK
to stop validating immediately.@Nonnull public com.helger.commons.state.EValidity getValidity()
getValidity
in class AbstractPSPartialValidationHandler
EValidity.VALID
if no failed
assertion and no successful report occurred,
EValidity.INVALID
otherwise.Copyright © 2014–2017 Philip Helger. All rights reserved.