public abstract class AbstractDifferenceEngine extends Object implements DifferenceEngine
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractDifferenceEngine.ComparisonState
Encapsulates the current result and a flag that
indicates whether comparison should be stopped.
|
protected static interface |
AbstractDifferenceEngine.DeferredComparison
Encapsulates a comparison that may or may not be performed.
|
protected class |
AbstractDifferenceEngine.FinishedComparisonState |
protected class |
AbstractDifferenceEngine.OngoingComparisonState |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDifferenceEngine() |
| Modifier and Type | Method and Description |
|---|---|
void |
addComparisonListener(ComparisonListener l)
Registers a listener that is notified of each comparison.
|
void |
addDifferenceListener(ComparisonListener l)
Registers a listener that is notified of each comparison with
outcome other than
ComparisonResult.EQUAL. |
void |
addMatchListener(ComparisonListener l)
Registers a listener that is notified of each comparison with
outcome
ComparisonResult.EQUAL. |
protected AbstractDifferenceEngine.ComparisonState |
compare(Comparison comp)
Compares the detail values for object equality, lets the
difference evaluator and comparison controller evaluate the
result, notifies all listeners and returns the outcome.
|
protected Predicate<Attr> |
getAttributeFilter()
Provides access to the configured ComparisonController.
|
protected ComparisonController |
getComparisonController()
Provides access to the configured ComparisonController.
|
protected DifferenceEvaluator |
getDifferenceEvaluator()
Provides access to the configured DifferenceEvaluator.
|
protected Map<String,String> |
getNamespaceContext()
Provides access to the configured namespace context.
|
protected Predicate<Node> |
getNodeFilter()
Provides access to the configured ComparisonController.
|
protected NodeMatcher |
getNodeMatcher()
Provides access to the configured NodeMatcher.
|
protected static String |
getParentXPath(XPathContext ctx)
Returns a string representation of the given XPathContext's parent context.
|
protected static String |
getXPath(XPathContext ctx)
Returns a string representation of the given XPathContext.
|
void |
setAttributeFilter(Predicate<Attr> af)
Sets the optional strategy that decides which attributes to
consider and which to ignore during comparison.
|
void |
setComparisonController(ComparisonController c)
Determines whether the comparison should stop after given
difference has been found.
|
void |
setDifferenceEvaluator(DifferenceEvaluator e)
Evaluates the severity of a difference.
|
void |
setNamespaceContext(Map<String,String> prefix2uri)
Establish a namespace context that will be used in
Comparison.Detail#getXPath. |
void |
setNodeFilter(Predicate<Node> nf)
Sets the optional strategy that decides which nodes to
consider and which to ignore during comparison.
|
void |
setNodeMatcher(NodeMatcher n)
Sets the strategy for selecting nodes to compare.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparepublic void addComparisonListener(ComparisonListener l)
DifferenceEngineaddComparisonListener in interface DifferenceEnginepublic void addMatchListener(ComparisonListener l)
DifferenceEngineComparisonResult.EQUAL.addMatchListener in interface DifferenceEnginepublic void addDifferenceListener(ComparisonListener l)
DifferenceEngineComparisonResult.EQUAL.addDifferenceListener in interface DifferenceEnginepublic void setNodeMatcher(NodeMatcher n)
DifferenceEnginesetNodeMatcher in interface DifferenceEngineprotected NodeMatcher getNodeMatcher()
public void setDifferenceEvaluator(DifferenceEvaluator e)
DifferenceEnginesetDifferenceEvaluator in interface DifferenceEngineprotected DifferenceEvaluator getDifferenceEvaluator()
public void setComparisonController(ComparisonController c)
DifferenceEnginesetComparisonController in interface DifferenceEngineprotected ComparisonController getComparisonController()
public void setNamespaceContext(Map<String,String> prefix2uri)
DifferenceEngineComparison.Detail#getXPath.
Without a namespace context (or with an empty context) the XPath expressions will only use local names for elements and attributes.
setNamespaceContext in interface DifferenceEngineprefix2uri - maps from prefix to namespace URI.protected Map<String,String> getNamespaceContext()
public void setAttributeFilter(Predicate<Attr> af)
DifferenceEngineOnly 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.
setAttributeFilter in interface DifferenceEngineprotected Predicate<Attr> getAttributeFilter()
public void setNodeFilter(Predicate<Node> nf)
DifferenceEngineOnly nodes for which the predicate returns true are part of the comparison. By default nodes that are not document types are considered.
setNodeFilter in interface DifferenceEngineprotected Predicate<Node> getNodeFilter()
protected final AbstractDifferenceEngine.ComparisonState compare(Comparison comp)
protected static String getXPath(XPathContext ctx)
protected static String getParentXPath(XPathContext ctx)
Copyright © 2001–2018 XMLUnit. All rights reserved.