Class ISBNValidator
- All Implemented Interfaces:
- Serializable
 This validator validates the code is either a valid ISBN-10
 (using a CodeValidator with the ISBN10CheckDigit)
 or a valid ISBN-13 code (using a CodeValidator with
 the EAN13CheckDigit routine).
 
 The validate() methods return the ISBN code with formatting
 characters removed if valid or null if invalid.
 
 This validator also provides the facility to convert ISBN-10 codes to
 ISBN-13 if the convert property is true.
 
From 1st January 2007 the book industry will start to use a new 13 digit ISBN number (rather than this 10 digit ISBN number). ISBN-13 codes are EAN codes, for more information see:
- Wikipedia - International Standard Book Number (ISBN).
- EAN - see Wikipedia - European Article Number.
- ISBN-13 Transition details.
ISBN-13s are either prefixed with 978 or 979. 978 prefixes are only assigned to the ISBN agency. 979 prefixes may be assigned to ISBNs or ISMNs (International Standard Music Numbers).
- 979-0 are assigned to the ISMN agency
- 979-10, 979-11, 979-12 are assigned to the ISBN agency
- Since:
- 1.4
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs an ISBN validator which converts ISBN-10 codes to ISBN-13.ISBNValidator(boolean convert) Constructs an ISBN validator indicating whether ISBN-10 codes should be converted to ISBN-13.
- 
Method SummaryModifier and TypeMethodDescriptionconvertToISBN13(String isbn10) Convert an ISBN-10 code to an ISBN-13 code.static ISBNValidatorGets the singleton instance of the ISBN validator which converts ISBN-10 codes to ISBN-13.static ISBNValidatorgetInstance(boolean convert) Gets the singleton instance of the ISBN validator specifying whether ISBN-10 codes should be converted to ISBN-13.booleanCheck the code is either a valid ISBN-10 or ISBN-13 code.booleanisValidISBN10(String code) Check the code is a valid ISBN-10 code.booleanisValidISBN13(String code) Check the code is a valid ISBN-13 code.Check the code is either a valid ISBN-10 or ISBN-13 code.validateISBN10(String code) Check the code is a valid ISBN-10 code.validateISBN13(String code) Check the code is a valid ISBN-13 code.
- 
Constructor Details- 
ISBNValidatorpublic ISBNValidator()Constructs an ISBN validator which converts ISBN-10 codes to ISBN-13.
- 
ISBNValidatorConstructs an ISBN validator indicating whether ISBN-10 codes should be converted to ISBN-13.- Parameters:
- convert-- trueif valid ISBN-10 codes should be converted to ISBN-13 codes or- falseif valid ISBN-10 codes should be returned unchanged.
 
 
- 
- 
Method Details- 
getInstanceGets the singleton instance of the ISBN validator which converts ISBN-10 codes to ISBN-13.- Returns:
- A singleton instance of the ISBN validator.
 
- 
getInstanceGets the singleton instance of the ISBN validator specifying whether ISBN-10 codes should be converted to ISBN-13.- Parameters:
- convert-- trueif valid ISBN-10 codes should be converted to ISBN-13 codes or- falseif valid ISBN-10 codes should be returned unchanged.
- Returns:
- A singleton instance of the ISBN validator.
 
- 
convertToISBN13Convert an ISBN-10 code to an ISBN-13 code.This method requires a valid ISBN-10 with NO formatting characters. - Parameters:
- isbn10- The ISBN-10 code to convert
- Returns:
- A converted ISBN-13 code or nullif the ISBN-10 code is not valid
 
- 
isValidCheck the code is either a valid ISBN-10 or ISBN-13 code.- Parameters:
- code- The code to validate.
- Returns:
- trueif a valid ISBN-10 or ISBN-13 code, otherwise- false.
 
- 
isValidISBN10Check the code is a valid ISBN-10 code.- Parameters:
- code- The code to validate.
- Returns:
- trueif a valid ISBN-10 code, otherwise- false.
 
- 
isValidISBN13Check the code is a valid ISBN-13 code.- Parameters:
- code- The code to validate.
- Returns:
- trueif a valid ISBN-13 code, otherwise- false.
 
- 
validateCheck the code is either a valid ISBN-10 or ISBN-13 code.If valid, this method returns the ISBN code with formatting characters removed (such as space or hyphen). Converts an ISBN-10 codes to ISBN-13 if convertToISBN13istrue.- Parameters:
- code- The code to validate.
- Returns:
- A valid ISBN code if valid, otherwise null.
 
- 
validateISBN10Check the code is a valid ISBN-10 code.If valid, this method returns the ISBN-10 code with formatting characters removed (such as space or hyphen). - Parameters:
- code- The code to validate.
- Returns:
- A valid ISBN-10 code if valid,
 otherwise null.
 
- 
validateISBN13Check the code is a valid ISBN-13 code.If valid, this method returns the ISBN-13 code with formatting characters removed (such as space or hyphen). - Parameters:
- code- The code to validate.
- Returns:
- A valid ISBN-13 code if valid,
 otherwise null.
 
 
-