Class MzTabBeanValidator

  • All Implemented Interfaces:
    de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>

    public class MzTabBeanValidator
    extends Object
    implements de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>

    This validator used the HibernateValidator bean validation reference implementation. It understands the standard annotations that are placed on the domain objects generated from Swagger Codegen.

    Author:
    nilshoffmann
    • Constructor Detail

      • MzTabBeanValidator

        public MzTabBeanValidator()
        Default constructor. Fail fast validation is disabled.
      • MzTabBeanValidator

        public MzTabBeanValidator​(boolean failFast)
        Constructor setting up the validator configuration and default constraint mapping.
        Parameters:
        failFast - if true, first validation error will terminate any further validation. If false, validation will continue and report all validation errors.
    • Method Detail

      • addConstraintAndValidator

        public <A extends Annotation,​T,​V extends javax.validation.ConstraintValidator<A,​T>> void addConstraintAndValidator​(Class<A> constraintDefinition,
                                                                                                                                             Class<V> validator,
                                                                                                                                             boolean includeExistingValidators)
        Allows registration of custom constraint / validator pairs on the validation configuration. This requires that the objects to be validated are annotated with the corresponding constraint definition.
        Type Parameters:
        A - The annotation marking elements that should be validated.
        T - The Object type on which the validation should be performed.
        V - The validator to use for the validation.
        Parameters:
        constraintDefinition - The annotation marking elements that should be validated.
        validator - The validator to use for the validation.
        includeExistingValidators - If true, existing validators for the same type will be applied, too. If false, only the registered validator will be retained for that type.
      • addConstraintAndValidator

        public <A extends Annotation,​T,​V extends javax.validation.ConstraintValidator<A,​T>> void addConstraintAndValidator​(Class<T> typeToValidate,
                                                                                                                                             Class<A> constraintDefinition,
                                                                                                                                             Class<V> validator,
                                                                                                                                             boolean includeExistingValidators)
        Allows registration of custom constraint / validator pairs on the validation configuration for a specific (unannotated) type.
        Type Parameters:
        A - The annotation marking elements that should be validated.
        T - The Object type on which the validation should be performed.
        V - The validator to use for the validation.
        Parameters:
        typeToValidate - The class/type that should be validated.
        constraintDefinition - The annotation marking elements that should be validated.
        validator - The validator to use for the validation.
        includeExistingValidators - If true, existing validators for the same type will be applied, too. If false, only the registered validator will be retained for that type.
      • validate

        public List<de.isas.mztab2.model.ValidationMessage> validate​(de.isas.mztab2.model.MzTab mzTab)
        Specified by:
        validate in interface de.isas.lipidomics.mztab2.validation.Validator<de.isas.mztab2.model.MzTab>
      • getPathLocatorString

        protected String getPathLocatorString​(javax.validation.ConstraintViolation<?> cv)

        getPathLocatorString.

        Parameters:
        cv - a ConstraintViolation object.
        Returns:
        a String object.