Package de.isas.mztab2.validation
Class CvMappingValidator
- java.lang.Object
-
- de.isas.mztab2.validation.CvMappingValidator
-
public class CvMappingValidator extends Object implements Validator<MzTab>
Validator implementation that uses a provided xml mapping file with rules for required, recommended and optional CV parameters to assert that an mzTab follows these rules. First, all preValidators are run, then, the cv parameter validation is executed, before finally, the postValidators are run. Each validator can add validation messages to the output.- Author:
- nilshoffmann
-
-
Constructor Summary
Constructors Constructor Description CvMappingValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CvMappingValidator
of(CvMapping mapping, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(File mappingFile, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(File mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(URL mappingFile, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.static CvMappingValidator
of(URL mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator.List<ValidationMessage>
validate(MzTab mzTab)
validate.CvMappingValidator
withPostValidator(Validator<MzTab> postValidator)
Add the provided validator implementation to the list of validators that run last.CvMappingValidator
withPreValidator(Validator<MzTab> preValidator)
Add the provided validator implementation to the list of validators that run first.
-
-
-
Constructor Detail
-
CvMappingValidator
public CvMappingValidator()
-
-
Method Detail
-
of
public static CvMappingValidator of(File mappingFile, boolean errorIfTermNotInRule) throws javax.xml.bind.JAXBException
Create a new instance of CvMappingValidator. Uses a default instance of theCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file to useerrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
javax.xml.bind.JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
of
public static CvMappingValidator of(File mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule) throws javax.xml.bind.JAXBException
Create a new instance of CvMappingValidator. Uses the providedCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file to useclient
- the ontology lookup service clienterrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
javax.xml.bind.JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
withPreValidator
public CvMappingValidator withPreValidator(Validator<MzTab> preValidator)
Add the provided validator implementation to the list of validators that run first.- Parameters:
preValidator
- the validator- Returns:
- an instance of this object
-
withPostValidator
public CvMappingValidator withPostValidator(Validator<MzTab> postValidator)
Add the provided validator implementation to the list of validators that run last.- Parameters:
postValidator
- the validator- Returns:
- an instance of this object
-
of
public static CvMappingValidator of(URL mappingFile, boolean errorIfTermNotInRule) throws javax.xml.bind.JAXBException
Create a new instance of CvMappingValidator. Uses a default instance of theCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file URL to useerrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
javax.xml.bind.JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
of
public static CvMappingValidator of(URL mappingFile, CvParameterLookupService client, boolean errorIfTermNotInRule) throws javax.xml.bind.JAXBException
Create a new instance of CvMappingValidator. Uses the providedCvParameterLookupService
.- Parameters:
mappingFile
- the mapping file URL to useclient
- the ontology lookup service clienterrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
- Throws:
javax.xml.bind.JAXBException
- if errors occur during unmarshalling of the mapping xml file.
-
of
public static CvMappingValidator of(CvMapping mapping, CvParameterLookupService client, boolean errorIfTermNotInRule)
Create a new instance of CvMappingValidator. Uses the providedCvParameterLookupService
.- Parameters:
mapping
- the cv mapping to useclient
- the ontology lookup service clienterrorIfTermNotInRule
- raise an error if a term is not defined within an otherwise matching rule for the element- Returns:
- a new CvMappingValidator instance
-
validate
public List<ValidationMessage> validate(MzTab mzTab)
Description copied from interface:Validator
validate.
Please make sure that all exceptions are caught within the validate method!
-
-