Package org.apache.pdfbox.preflight
Class ValidationResult
- java.lang.Object
-
- org.apache.pdfbox.preflight.ValidationResult
-
public class ValidationResult extends java.lang.Object
Object returned by the validate method of the PDFValidator. This object contains a boolean to know if the PDF is PDF/A-1x compliant. If the document isn't PDF/A-1x a list of errors is provided.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ValidationResult.ValidationError
This Class represents an error of validation.
-
Field Summary
Fields Modifier and Type Field Description private boolean
isValid
Boolean to know if the PDF is a valid PDF/Aprivate java.util.List<ValidationResult.ValidationError>
lErrors
Errors to know why the PDF isn't valid.private XMPMetadata
xmpMetaData
Object representation of the XMPMetaData contained by the pdf file This attribute can be null if the Validation fails.
-
Constructor Summary
Constructors Constructor Description ValidationResult(boolean isValid)
Create a Validation result objectValidationResult(java.util.List<ValidationResult.ValidationError> errors)
Create a Validation Result object.ValidationResult(ValidationResult.ValidationError error)
Create a Validation Result object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(ValidationResult.ValidationError error)
Add error to the list of ValidationError.void
addErrors(java.util.List<ValidationResult.ValidationError> errors)
Add a set of errors to the list of ValidationError.java.util.List<ValidationResult.ValidationError>
getErrorsList()
XMPMetadata
getXmpMetaData()
boolean
isValid()
void
mergeResult(ValidationResult otherResult)
Add the ValidationError object of the otherResult in the Error list of the current object.(package private) void
setXmpMetaData(XMPMetadata xmpMetaData)
-
-
-
Field Detail
-
isValid
private boolean isValid
Boolean to know if the PDF is a valid PDF/A
-
lErrors
private java.util.List<ValidationResult.ValidationError> lErrors
Errors to know why the PDF isn't valid. If the PDF is valid, this list is empty.
-
xmpMetaData
private XMPMetadata xmpMetaData
Object representation of the XMPMetaData contained by the pdf file This attribute can be null if the Validation fails.
-
-
Constructor Detail
-
ValidationResult
public ValidationResult(boolean isValid)
Create a Validation result object- Parameters:
isValid
-
-
ValidationResult
public ValidationResult(ValidationResult.ValidationError error)
Create a Validation Result object. This constructor force the isValid to false and add the given error to the list or ValidationErrors.- Parameters:
error
- if error is null, no error is added to the list.
-
ValidationResult
public ValidationResult(java.util.List<ValidationResult.ValidationError> errors)
Create a Validation Result object. This constructor force the isValid to false and add all the given errors to the list or ValidationErrors.- Parameters:
errors
- if error is null, no error is added to the list.
-
-
Method Detail
-
mergeResult
public void mergeResult(ValidationResult otherResult)
Add the ValidationError object of the otherResult in the Error list of the current object. Apply a logical AND on the isValid boolean.- Parameters:
otherResult
-
-
getXmpMetaData
public XMPMetadata getXmpMetaData()
- Returns:
- the xmpMetaData
-
setXmpMetaData
void setXmpMetaData(XMPMetadata xmpMetaData)
- Parameters:
xmpMetaData
- the xmpMetaData to set
-
isValid
public boolean isValid()
- Returns:
- true if the PDF is valid,false otherwise
-
addError
public void addError(ValidationResult.ValidationError error)
Add error to the list of ValidationError. If the given error is null, this method does nothing- Parameters:
error
-
-
addErrors
public void addErrors(java.util.List<ValidationResult.ValidationError> errors)
Add a set of errors to the list of ValidationError. If the given list is null, this method does nothing.- Parameters:
errors
-
-
getErrorsList
public java.util.List<ValidationResult.ValidationError> getErrorsList()
- Returns:
- the list of validation errors
-
-