Class ISBN

  • All Implemented Interfaces:
    Serializable

    public final class ISBN
    extends Object
    implements 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:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(Object obj)
      Two ISBN objects with the same ISBN-13 representation are treated equal.
      String getAgencyName()
      The range definition from the International ISBN Agency associates a name with each prefix.
      char getCheckdigit()
      To meet the EAN criteria for valid article numbers, each ISBN has an additional digit to increase redundancy and to spot errors.
      String getGroup()
      There are group codes assigned with each local ISBN agency, e.g. for single countries or language regions.
      String getGroupName()
      The range definition from the Internation ISBN Agency associates a name with each local group.
      String getGroupPrefix()
      The group prefix is the substring that all valid ISBNs from that group start with.
      String getPrefix()
      The EAN/UCC prefix represents the country/region in the EAN/GTIN standard.
      String getPublisher()
      There are local ISBN agencies around the world take care of assigning number ranges for publishers.
      String getPublisherPrefix()
      The publisher prefix is the substring that all valid ISBNs from that publisher range start with.
      String getTitle()
      Each publication has a title identifier that is unique within the publisher's number range.
      int hashCode()  
      String toCompactString()
      Returns the compact ISBN-13 representation.
      String toString()
      Returns the correctly hyphened ISBN-13 representation.
      URI toURI()
      Returns the URI for this ISBN.
      static ISBN valueOf​(String isbn)
      Parses a given string input and returns an ISBN object.
    • Method Detail

      • getPrefix

        public String 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

        public String 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

        public String 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

        public String 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

        public String 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

        public String getPublisher()
        There are local ISBN agencies around the world take care of assigning number ranges for publishers. This is the third piece of the ISBN.
                ,–––⹁
           978-0-557-50469-5
                `–––´
         
        Returns:
        the publisher code of the ISBN, e.g. "557"
      • getPublisherPrefix

        public String getPublisherPrefix()
        The publisher prefix is the substring that all valid ISBNs from that publisher range start with.
          ,–––––––––⹁
           978-0-557-50469-5
          `–––––––––´
         
        Returns:
        the group code of the ISBN, e.g. "978-0-557"
      • getTitle

        public String 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

        public String toString()
        Returns the correctly hyphened ISBN-13 representation.
        Overrides:
        toString in class Object
        Returns:
        the official ISBN-13 representation, e.g. "978-0-557-50469-5"
      • toCompactString

        public String toCompactString()
        Returns the compact ISBN-13 representation.
        Returns:
        the compact ISBN-13 representation, e.g. "9780557504695"
      • toURI

        public URI toURI()
        Returns the URI for this ISBN.
        Returns:
        the URI pointing to this ISBN, e.g. "urn:isbn:9780557504695"
      • equals

        public boolean equals​(Object obj)
        Two ISBN objects with the same ISBN-13 representation are treated equal.
        Overrides:
        equals in class Object
        Returns:
        whether this ISBN is equal to another ISBN object.