Package com.itextpdf.kernel.utils
Class CompareTool.CompareResult
- java.lang.Object
-
- com.itextpdf.kernel.utils.CompareTool.CompareResult
-
- Enclosing class:
- CompareTool
public static class CompareTool.CompareResult extends java.lang.ObjectClass containing results of the comparison of two documents.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<ObjectPath,java.lang.String>differencesprotected intmessageLimit
-
Constructor Summary
Constructors Constructor Description CompareResult(int messageLimit)Creates new empty instance of CompareResult with given limit of difference messages.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddError(ObjectPath path, java.lang.String message)Adds an error message for theObjectPath.java.util.Map<ObjectPath,java.lang.String>getDifferences()Returns map withObjectPathas keys and difference descriptions as values.intgetErrorCount()Returns number of differences between two documents detected during comparison.java.lang.StringgetReport()Converts this CompareResult into text form.protected booleanisMessageLimitReached()Checks whether maximum number of difference messages to be handled by this CompareResult is reached.booleanisOk()Verifies if documents are considered equal after comparison.voidwriteReportToXml(java.io.OutputStream stream)Converts this CompareResult into xml form.
-
-
-
Field Detail
-
differences
protected java.util.Map<ObjectPath,java.lang.String> differences
-
messageLimit
protected int messageLimit
-
-
Method Detail
-
isOk
public boolean isOk()
Verifies if documents are considered equal after comparison.- Returns:
- true if documents are equal, false otherwise.
-
getErrorCount
public int getErrorCount()
Returns number of differences between two documents detected during comparison.- Returns:
- number of differences.
-
getReport
public java.lang.String getReport()
Converts this CompareResult into text form.- Returns:
- text report on the differences between two documents.
-
getDifferences
public java.util.Map<ObjectPath,java.lang.String> getDifferences()
Returns map withObjectPathas keys and difference descriptions as values.- Returns:
- differences map which could be used to find in the document the objects that are different.
-
writeReportToXml
public void writeReportToXml(java.io.OutputStream stream) throws javax.xml.parsers.ParserConfigurationException, javax.xml.transform.TransformerExceptionConverts this CompareResult into xml form.- Parameters:
stream- output stream to which xml report will be written.- Throws:
javax.xml.parsers.ParserConfigurationException- if a XML DocumentBuilder cannot be created which satisfies the configuration requested.javax.xml.transform.TransformerException- if it is not possible to create an XML Transformer instance or an unrecoverable error occurs during the course of the transformation.
-
isMessageLimitReached
protected boolean isMessageLimitReached()
Checks whether maximum number of difference messages to be handled by this CompareResult is reached.- Returns:
- true if limit of difference messages is reached, false otherwise.
-
addError
protected void addError(ObjectPath path, java.lang.String message)
Adds an error message for theObjectPath.- Parameters:
path-ObjectPathfor the two corresponding objects in the compared documentsmessage- an error message
-
-