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:
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.ISBN10CheckDigitCHECK_ISBN10apache commons class to check/calculate ISBN10 check sums.protected static org.apache.commons.validator.routines.checkdigit.EAN13CheckDigitCHECK_ISBN13apache commons class to check/calculate GLN/EAN13 check sums (it's the same for isbn13).protected booleancheckIsbn10should isbn10 be checked (true/false).protected booleancheckIsbn13should isbn13 be checked (true/false).protected booleanignoreSeparatorsshould separating minus signs be ignored (true/false).static intISBN10_LENGTHdefinition of isbn10 length.static intISBN13_LENGTHdefinition of isbn13 length.
-
Constructor Summary
Constructors Constructor Description AbstractIsbnValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisValid(Object pvalue, javax.validation.ConstraintValidatorContext pcontext)check if given string is a valid isbn.
-
-
-
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).
-
-
Method Detail
-
isValid
public boolean isValid(Object pvalue, javax.validation.ConstraintValidatorContext pcontext)
check if given string is a valid isbn.- Specified by:
isValidin interfacejavax.validation.ConstraintValidator<A extends Annotation,Object>- See Also:
ConstraintValidator.isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
-
-