|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.validator.ISBNValidator
A class for validating 10 digit ISBN codes. Based on this algorithm
Field Summary | |
private static java.lang.String |
CHECK
|
private static java.lang.String |
GROUP
|
private static java.lang.String |
ISBN_PATTERN
ISBN consists of 4 groups of numbers separated by either dashes (-) or spaces. |
private static java.lang.String |
PUBLISHER
|
private static java.lang.String |
SEP
|
private static java.lang.String |
TITLE
|
Constructor Summary | |
ISBNValidator()
Default Constructor. |
Method Summary | |
private java.lang.String |
clean(java.lang.String isbn)
Removes all non-digit characters except for 'X' which is a valid ISBN character. |
private boolean |
isFormatted(java.lang.String isbn)
Returns true if the ISBN contains one of the separator characters space or dash. |
boolean |
isValid(java.lang.String isbn)
If the ISBN is formatted with space or dash separators its format is validated. |
private boolean |
isValidPattern(java.lang.String isbn)
Returns true if the ISBN is formatted properly. |
private int |
sum(java.lang.String isbn)
Returns the sum of the weighted ISBN characters. |
private int |
toInt(char ch)
Returns the numeric value represented by the character. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String SEP
private static final java.lang.String GROUP
private static final java.lang.String PUBLISHER
private static final java.lang.String TITLE
private static final java.lang.String CHECK
private static final java.lang.String ISBN_PATTERN
Constructor Detail |
public ISBNValidator()
Method Detail |
public boolean isValid(java.lang.String isbn)
isbn
- Candidate ISBN number to be validated. null
is
considered invalid.
private int sum(java.lang.String isbn)
private java.lang.String clean(java.lang.String isbn)
private int toInt(char ch)
private boolean isFormatted(java.lang.String isbn)
private boolean isValidPattern(java.lang.String isbn)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |