Class AbstractIsbnValidator<A extends Annotation>

java.lang.Object
de.knightsoftnet.validators.shared.impl.AbstractIsbnValidator<A>
Type Parameters:
A - the annotation type handled by an implementation
All Implemented Interfaces:
jakarta.validation.ConstraintValidator<A,Object>
Direct Known Subclasses:
Isbn10Validator, Isbn13Validator, IsbnValidator

public abstract class AbstractIsbnValidator<A extends Annotation> extends Object implements jakarta.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 final org.apache.commons.validator.routines.checkdigit.ISBN10CheckDigit
    apache commons class to check/calculate ISBN10 check sums.
    protected static final org.apache.commons.validator.routines.checkdigit.EAN13CheckDigit
    apache commons class to check/calculate GLN/EAN13 check sums (it's the same for isbn13).
    protected boolean
    should isbn10 be checked (true/false).
    protected boolean
    should isbn13 be checked (true/false).
    protected boolean
    should separating minus signs be ignored (true/false).
    static final int
    definition of isbn10 length.
    static final int
    definition of isbn13 length.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isValid(Object pvalue, jakarta.validation.ConstraintValidatorContext pcontext)
    check if given string is a valid isbn.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.validation.ConstraintValidator

    initialize
  • Field Details

    • ISBN10_LENGTH

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

      public static final int ISBN13_LENGTH
      definition of isbn13 length.
      See Also:
    • 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 Details

    • AbstractIsbnValidator

      public AbstractIsbnValidator()
  • Method Details

    • isValid

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