public final class Profiles extends Object
ValidationProfiles and associated classes.
The utility methods generally fall into one of the following categories:
defaultTypeName(), used for
testing or when a vanilla instance of a particular type is required.typeNameFromValues(...), used
to create instances from their contained types.typeNameToXml(...), to facilitate XML
serialisation to Strings, OutputStreams and Writers.typeNameFromXml(...), to facilitate XML
deserialisation.TODO: Defensive Checks for all parameters.
| Modifier and Type | Class and Description |
|---|---|
static class |
Profiles.RuleComparator |
static class |
Profiles.RuleIdComparator |
| Constructor and Description |
|---|
Profiles() |
| Modifier and Type | Method and Description |
|---|---|
static ErrorDetails |
defaultError()
Returns an immutable default instance of ErrorDetails.
|
static ValidationProfile |
defaultProfile()
Returns an immutable default instance of a ValidationProfile.
|
static Reference |
defaultReference()
Returns an immutable default instance of a Reference.
|
static Rule |
defaultRule()
Returns an immutable default instance of a Rule.
|
static RuleId |
defaultRuleId()
Returns an immutable default instance of a RuleId.
|
static Variable |
defaultVariable()
Returns an immutable default instance of a Variable.
|
static ProfileDirectory |
directoryFromProfiles(Set<ValidationProfile> profiles)
|
static ErrorDetails |
errorFromValues(String message,
List<String> arguments)
Returns a
ErrorDetails instance initialised with the passed
values. |
static String |
getValidationProfileSchema()
Returns the JAXB generated XML schema for the ValidationProfileImpl type.
|
static ProfileDirectory |
getVeraProfileDirectory()
Returns a
ProfileDirectory instance that has been pre-populated
with the curated ValidationProfiles supplied with the veraPDF
library. |
static ProfileDetails |
profileDetailsFromValues(String name,
String description,
String creator,
Date created)
Returns a
ProfileDetails instance initialised using the passed
values. |
static ValidationProfile |
profileFromSortedValues(PDFAFlavour flavour,
ProfileDetails details,
String hash,
SortedSet<Rule> rules,
Set<Variable> variables)
Returns a
ValidationProfile instance initialised with the passed
values. |
static ValidationProfile |
profileFromValues(PDFAFlavour flavour,
ProfileDetails details,
String hash,
Set<Rule> rules,
Set<Variable> variables)
Returns a
ValidationProfile instance initialised with the passed
values. |
static ValidationProfile |
profileFromXml(InputStream source)
Attempt to de-serialise and return a
ValidationProfile instance
from an XML representation that can be read from toConvert. |
static String |
profileToXml(ValidationProfile toConvert,
boolean format,
boolean fragment)
Convert a
ValidationProfile instance into an XML String. |
static void |
profileToXml(ValidationProfile toConvert,
OutputStream dest,
boolean format,
boolean fragment)
|
static void |
profileToXml(ValidationProfile toConvert,
Writer dest,
boolean format,
boolean fragment)
|
static Reference |
referenceFromValues(String specification,
String clause)
Returns a
Reference instance initialised with the passed values. |
static Rule |
ruleFromValues(RuleId id,
String object,
Boolean deferred,
String description,
String test,
ErrorDetails error,
List<Reference> references)
Returns a
Rule instance initialised with the passed values. |
static Rule |
ruleFromValues(RuleId id,
String object,
String description,
String test,
ErrorDetails error,
List<Reference> references)
Returns a
Rule instance initialised with the passed values. |
static RuleId |
ruleIdFromValues(PDFAFlavour.Specification specification,
String clause,
int testNumber)
Returns a
RuleId instance initialised with the passed values. |
static Variable |
variableFromValues(String name,
String object,
String defaultValue,
String value)
Returns a
Variable instance initialised with the passed values. |
public static ValidationProfile profileFromValues(PDFAFlavour flavour, ProfileDetails details, String hash, Set<Rule> rules, Set<Variable> variables)
ValidationProfile instance initialised with the passed
values.flavour - the PDF/A flavour supported by this profile represented as a
PDFAFlavour instance.details - the ProfileDetails for the profile.hash - an identifying hash for the profilerules - the Set of Rules for the profilevariables - the Set of Variables for the profileIllegalArgumentException - if any of the passed parameters are null or if any of name,
description or creator are empty.public static ValidationProfile profileFromSortedValues(PDFAFlavour flavour, ProfileDetails details, String hash, SortedSet<Rule> rules, Set<Variable> variables)
ValidationProfile instance initialised with the passed
values.flavour - the PDF/A flavour supported by this profile represented as a
PDFAFlavour instance.details - the ProfileDetails for the profile.hash - an identifying hash for the profilerules - the Set of Rules for the profilevariables - the Set of Variables for the profileIllegalArgumentException - if any of the passed parameters are null or if any of name,
description or creator are empty.public static ValidationProfile defaultProfile()
Profiles.defaultProfile() == Profiles.defaultProfile() is
always true.ValidationProfile default instancepublic static ProfileDetails profileDetailsFromValues(String name, String description, String creator, Date created)
ProfileDetails instance initialised using the passed
values.name - a String name that identifies the profiledescription - a short, textual String description of the profile.creator - a String that identifies the creator of the profilecreated - a Date instance indicating when the profile was
created.public static Reference defaultReference()
Profiles.defaultReference() == Profiles.defaultReference()
is always true.Reference default instancepublic static Reference referenceFromValues(String specification, String clause)
Reference instance initialised with the passed values.specification - a String identifying the specification the Reference
refers to.clause - a String identifying the location referred to within the
specification.IllegalArgumentException - if any of the parameters are null or the specification is
emptypublic static RuleId defaultRuleId()
Profiles.defaultRuleId() == Profiles.defaultRuleId() is
always true.RuleId default instancepublic static RuleId ruleIdFromValues(PDFAFlavour.Specification specification, String clause, int testNumber)
RuleId instance initialised with the passed values.specification - a PDFAFlavour.Specification instance identifying the PDF/A
specification part the RuleId is derivedclause - a String that identifies that clause within the specification
that the RuleId is derivedtestNumber - an int that identifies the test number for the
RuleIdIllegalArgumentException - if any of the parameters are null or the clause is emptypublic static Rule defaultRule()
Profiles.defaultRule() == Profiles.defaultRule() is always
true.Rule default instancepublic static ErrorDetails defaultError()
Profiles.defaultError() == Profiles.defaultError() is always
true.ErrorDetails default instancepublic static ErrorDetails errorFromValues(String message, List<String> arguments)
ErrorDetails instance initialised with the passed
values.message - a String message for the ErrorDetailsarguments - a List of String arguments for the ErrorDetails.ErrorDetails instanceIllegalArgumentException - if any of the parameters are null or message is emptypublic static Rule ruleFromValues(RuleId id, String object, String description, String test, ErrorDetails error, List<Reference> references)
Rule instance initialised with the passed values.id - the RuleId id for the Ruleobject - a String that identifies the Object that the rule applies todescription - a textual description of the Rule.test - a JavaScript expression that is the test carried out on a
model instanceerror - the ErrorDetails associated with theRule.references - a list of further References for this ruleRule instance.IllegalArgumentException - if any of the parameters are null or the test, object, or
description is emptypublic static Rule ruleFromValues(RuleId id, String object, Boolean deferred, String description, String test, ErrorDetails error, List<Reference> references)
Rule instance initialised with the passed values.id - the RuleId id for the Ruleobject - a String that identifies the Object that the rule applies todeferred - a Boolean that identifies the deferred property of the ruledescription - a textual description of the Rule.test - a JavaScript expression that is the test carried out on a
model instanceerror - the ErrorDetails associated with theRule.references - a list of further References for this ruleRule instance.IllegalArgumentException - if any of the parameters are null or the test, object, or
description is emptypublic static Variable defaultVariable()
Profiles.defaultVariable() == Profiles.defaultVariable() is
always true.Variable default instancepublic static Variable variableFromValues(String name, String object, String defaultValue, String value)
Variable instance initialised with the passed values.name - a name for the Variableobject - a String identifying the object type for the VariabledefaultValue - a String default value for the Variablevalue - a value for the for the VariableVariable instanceIllegalArgumentException - if any of the parameters are null or emptypublic static String profileToXml(ValidationProfile toConvert, boolean format, boolean fragment) throws JAXBException
ValidationProfile instance into an XML String.toConvert - a ValidationProfile to convert to an XML StringprettyXml - set to Boolean.TRUE for pretty formatted XML, Boolean.FALSE
for no space formattingJAXBException - thrown by JAXB marshaller if there's an error converting the
objectIOException - thrown when's there's a problem closing the underlying
StringWriterIllegalArgumentException - if toConvert is nullpublic static void profileToXml(ValidationProfile toConvert, OutputStream dest, boolean format, boolean fragment) throws JAXBException
toConvert - a ValidationProfile to convert to an XML StringforXmlOutput - an OutputStream used to write the generated XML toprettyXml - set to Boolean.TRUE for pretty formatted XML, Boolean.FALSE
for no space formattingJAXBException - thrown by JAXB marshaller if there's an error converting the
objectIllegalArgumentException - if toConvert is nullpublic static ValidationProfile profileFromXml(InputStream source) throws JAXBException
ValidationProfile instance
from an XML representation that can be read from toConvert.toConvert - an InputStream to an XML representation of a profileValidationProfile instanceJAXBException - thrown by JAXB marshaller if there's an error converting the
objectIllegalArgumentException - if toConvert is nullpublic static void profileToXml(ValidationProfile toConvert, Writer dest, boolean format, boolean fragment) throws JAXBException
toConvert - a ValidationProfile to convert to an XML StringforXmlOutput - a Writer used to write the generated XML toprettyXml - set to Boolean.TRUE for pretty formatted XML, Boolean.FALSE
for no space formattingJAXBException - thrown by JAXB marshaller if there's an error converting the
objectIllegalArgumentException - if toConvert is nullpublic static ProfileDirectory directoryFromProfiles(Set<ValidationProfile> profiles)
ProfileDirectory from a Set of
ValidationProfiles. Note that the returned directory uses each
ValidationProfile's associated PDFAFlavour as a
directory key. This means that only a single
ValidationProfile can be associated with a particular
PDFAFlavour. If the Set of Profiles passed in
profiles contains multiple ValidationProfiles
with the same PDFAFlavour only one will be contained in the
returned ProfileDirectory. Which one is indeterminate.profiles - a Set of ValidationProfiles used to populate the
directory instanceValidationProfiles
passed in the profiles parameterIllegalArgumentException - if the profiles parameter is null or emptypublic static ProfileDirectory getVeraProfileDirectory()
ProfileDirectory instance that has been pre-populated
with the curated ValidationProfiles supplied with the veraPDF
library.
While the veraPDF library and associated ValidationProfiles
are under development, there is no guarantee that the profiles supplied
are complete and accurate. Please check the validation
profiles GitHub repo to find out the current status of our
ValidationProfiles.
public static String getValidationProfileSchema() throws JAXBException, IOException
JAXBException - if there's a problem marshaling the schemaIOException - if there's a problem outputting the resultCopyright © 2015–2018 The veraPDF Consortium. All rights reserved.