Class ISBN
java.lang.Object
de.creativecouple.validation.isbn.ISBN
- All Implemented Interfaces:
Serializable
Simple domain object, representing a single ISBN identifier. Usage:
ISBN isbn1 = ISBN.valueOf("978-0557504695");
isbn1.toString(); // "978-0-557-50469-5"
ISBN isbn2 = ISBN.valueOf("0-557-50469-4");
isbn2.toString(); // "978-0-557-50469-5"
isbn1.equals(isbn2); // true
- Author:
- Peter Liske (CreativeCouple)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo ISBN objects with the same ISBN-13 representation are treated equal.The range definition from the International ISBN Agency associates a name with each prefix.charTo meet the EAN criteria for valid article numbers, each ISBN has an additional digit to increase redundancy and to spot errors.getGroup()There are group codes assigned with each local ISBN agency, e.g.The range definition from the Internation ISBN Agency associates a name with each local group.The group prefix is the substring that all valid ISBNs from that group start with.The EAN/UCC prefix represents the country/region in the EAN/GTIN standard.There are local ISBN agencies around the world who take care of assigning number ranges for publishers.The publisher prefix is the substring that all valid ISBNs from that publisher range start with.getTitle()Each publication has a title identifier that is unique within the publisher's number range.inthashCode()Returns the compact ISBN-13 representation.toString()Returns the correctly hyphened ISBN-13 representation.toURI()Returns the URI for this ISBN.static ISBNParses a given string input and returns an ISBN object.
-
Method Details
-
getPrefix
The EAN/UCC prefix represents the country/region in the EAN/GTIN standard. Currently only "978" and "979" are associated with the International ISBN Agency.,–––⹁ 978-0-557-50469-5 `–––´
- Returns:
- the ISBN prefix, e.g. "978" or "979"
-
getAgencyName
The range definition from the International ISBN Agency associates a name with each prefix. So far this is always "International ISBN Agency".- Returns:
- the agency's name associated with the ISBN prefix
-
getGroup
There are group codes assigned with each local ISBN agency, e.g. for single countries or language regions. It is the second piece of the ISBN.,–⹁ 978-0-557-50469-5 `–´- Returns:
- the group code of the ISBN, e.g. "0" or "610"
-
getGroupPrefix
The group prefix is the substring that all valid ISBNs from that group start with.,–––––⹁ 978-0-557-50469-5 `–––––´
- Returns:
- the group code of the ISBN, e.g. "978-0"
-
getGroupName
The range definition from the Internation ISBN Agency associates a name with each local group.- Returns:
- the agency's name associated with the group prefix, e.g. "English language" or "Turkey"
-
getPublisher
There are local ISBN agencies around the world who take care of assigning number ranges for publishers. This is the publisher code third piece of the ISBN.,–––⹁ 978-0-557-50469-5 `–––´- Returns:
- the publisher code of the ISBN, e.g. "557"
-
getPublisherPrefix
The publisher prefix is the substring that all valid ISBNs from that publisher range start with.,–––––––––⹁ 978-0-557-50469-5 `–––––––––´
- Returns:
- the publisher's prefix of the ISBN, e.g. "978-0-557"
-
getTitle
Each publication has a title identifier that is unique within the publisher's number range. It is the fourth piece of the ISBN.,–––––⹁ 978-0-557-50469-5 `–––––´- Returns:
- the title code of the ISBN, e.g. "50469"
-
getCheckdigit
public char getCheckdigit()To meet the EAN criteria for valid article numbers, each ISBN has an additional digit to increase redundancy and to spot errors. It is a number from '0' to '9'. If any single digit of the ISBN string changes, it will become invalid.,–⹁ 978-0-557-50469-5 `–´- Returns:
- the checkdigit of the ISBN, e.g. '5'
-
toString
Returns the correctly hyphened ISBN-13 representation. -
toCompactString
Returns the compact ISBN-13 representation.- Returns:
- the compact ISBN-13 representation, e.g. "9780557504695"
-
toURI
Returns the URI for this ISBN.- Returns:
- the URI pointing to this ISBN, e.g. "urn:isbn:9780557504695"
-
equals
Two ISBN objects with the same ISBN-13 representation are treated equal. -
hashCode
public int hashCode() -
valueOf
Parses a given string input and returns an ISBN object.- Returns:
- the ISBN object
- Throws:
NumberFormatException- if the input is not an ISBNIllegalArgumentException
-