Class AbstractIsbnValidator<A extends Annotation>

  • Type Parameters:
    A - the annotation type handled by an implementation
    All Implemented Interfaces:
    javax.validation.ConstraintValidator<A,​Object>
    Direct Known Subclasses:
    Isbn10Validator, Isbn13Validator, IsbnValidator

    public abstract class AbstractIsbnValidator<A extends Annotation>
    extends Object
    implements javax.validation.ConstraintValidator<A,​Object>
    Abstract check a string if it's a valid ISBN.
    Author:
    Manfred Tremmel
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static org.apache.commons.validator.routines.checkdigit.ISBN10CheckDigit CHECK_ISBN10
      apache commons class to check/calculate ISBN10 check sums.
      protected static org.apache.commons.validator.routines.checkdigit.EAN13CheckDigit CHECK_ISBN13
      apache commons class to check/calculate GLN/EAN13 check sums (it's the same for isbn13).
      protected boolean checkIsbn10
      should isbn10 be checked (true/false).
      protected boolean checkIsbn13
      should isbn13 be checked (true/false).
      protected boolean ignoreSeparators
      should separating minus signs be ignored (true/false).
      static int ISBN10_LENGTH
      definition of isbn10 length.
      static int ISBN13_LENGTH
      definition of isbn13 length.
    • Field Detail

      • ISBN10_LENGTH

        public static final int ISBN10_LENGTH
        definition of isbn10 length.
        See Also:
        Constant Field Values
      • ISBN13_LENGTH

        public static final int ISBN13_LENGTH
        definition of isbn13 length.
        See Also:
        Constant Field Values
      • CHECK_ISBN10

        protected static final org.apache.commons.validator.routines.checkdigit.ISBN10CheckDigit CHECK_ISBN10
        apache commons class to check/calculate ISBN10 check sums.
      • CHECK_ISBN13

        protected static final org.apache.commons.validator.routines.checkdigit.EAN13CheckDigit CHECK_ISBN13
        apache commons class to check/calculate GLN/EAN13 check sums (it's the same for isbn13).
      • ignoreSeparators

        protected boolean ignoreSeparators
        should separating minus signs be ignored (true/false).
      • checkIsbn10

        protected boolean checkIsbn10
        should isbn10 be checked (true/false).
      • checkIsbn13

        protected boolean checkIsbn13
        should isbn13 be checked (true/false).
    • Constructor Detail

      • AbstractIsbnValidator

        public AbstractIsbnValidator()
    • Method Detail

      • isValid

        public boolean isValid​(Object pvalue,
                               javax.validation.ConstraintValidatorContext pcontext)
        check if given string is a valid isbn.
        Specified by:
        isValid in interface javax.validation.ConstraintValidator<A extends Annotation,​Object>
        See Also:
        ConstraintValidator.isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)