Interface DifferenceEngineConfigurer<D extends DifferenceEngineConfigurer<D>>
- All Known Implementing Classes:
CompareAssert
,CompareMatcher
,DiffBuilder
invalid reference
DifferenceEngine
- Since:
- 2.6.0
-
Method Summary
Modifier and TypeMethodDescriptionwithAttributeFilter
(Predicate<Attr> attributeFilter) Registers a filter for attributes.withComparisonController
(ComparisonController comparisonController) Replace theinvalid reference
ComparisonControllers#Default
withComparisonFormatter
(ComparisonFormatter formatter) Sets a non-default formatter for the differences found.withComparisonListeners
(ComparisonListener... comparisonListeners) Registers listeners that are notified of each comparison.withDifferenceEvaluator
(DifferenceEvaluator differenceEvaluator) Provide your own customDifferenceEvaluator
implementation.withDifferenceListeners
(ComparisonListener... comparisonListeners) Registers listeners that are notified of each comparison with outcome other thaninvalid reference
ComparisonResult#EQUAL
withNamespaceContext
(Map<String, String> prefix2Uri) Establish a namespace context that will be used inComparison.Detail#getXPath
.withNodeFilter
(Predicate<Node> nodeFilter) Registers a filter for nodes.withNodeMatcher
(NodeMatcher nodeMatcher) Sets the strategy for selecting nodes to compare.
-
Method Details
-
withNodeMatcher
Sets the strategy for selecting nodes to compare.Example with
DefaultNodeMatcher
:.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText))
This overwrites any
NodeMatcher
set via earlier invocations ofwithNodeMatcher
.- See Also:
-
withDifferenceEvaluator
Provide your own customDifferenceEvaluator
implementation.This overwrites the Default DifferenceEvaluator.
If you want use your custom DifferenceEvaluator in combination with the default or another DifferenceEvaluator you should use
invalid reference
DifferenceEvaluators#chain(DifferenceEvaluator...)
invalid reference
DifferenceEvaluators#first(DifferenceEvaluator...)
.withDifferenceEvaluator( DifferenceEvaluators.chain( DifferenceEvaluators.Default, new MyCustomDifferenceEvaluator())) ....
This overwrites any
DifferenceEvaluator
set via earlier invocations ofwithDifferenceEvaluator
. -
withComparisonController
Replace theinvalid reference
ComparisonControllers#Default
Example use:
.withComparisonController(ComparisonControllers.StopWhenDifferent)
This overwrites any
ComparisonController
set via earlier invocations ofwithComparisonController
. -
withComparisonListeners
Registers listeners that are notified of each comparison.- See Also:
-
withDifferenceListeners
Registers listeners that are notified of each comparison with outcome other thaninvalid reference
ComparisonResult#EQUAL
This overwrites any
ComparisonListener
s set via earlier invocations ofwithDifferenceListeners
.- See Also:
-
withNamespaceContext
Establish a namespace context that will be used inComparison.Detail#getXPath
.Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.
This overwrites any
Map
set via earlier invocations ofwithNamespaceContext
.- Parameters:
prefix2Uri
- mapping between prefix and namespace URI
-
withAttributeFilter
Registers a filter for attributes.Only attributes for which the predicate returns true are part of the comparison. By default all attributes are considered.
The "special" namespace, namespace-location and schema-instance-type attributes can not be ignored this way. If you want to suppress comparison of them you'll need to implement
DifferenceEvaluator
.This overwrites any
Predicate
set via earlier invocations ofwithAttributeFilter
. -
withNodeFilter
Registers a filter for nodes.Only nodes for which the predicate returns true are part of the comparison. By default nodes that are not document types are considered.
This overwrites any
Predicate
set via earlier invocations ofwithNodeFilter
. -
withComparisonFormatter
Sets a non-default formatter for the differences found.This overwrites any
ComparisonFormatter
set via earlier invocations ofwithComparisonFormatter
.
-