1 25 26 package org.objectweb.speedo.pobjects.fetchgroup; 27 28 31 public class BookId { 32 33 public static final String SEP = ":"; 34 public int isbn; 35 public String type; 36 37 public BookId() { 38 } 39 40 public BookId(int isbn, String type) { 41 this.isbn = isbn; 42 this.type = type; 43 } 44 45 public BookId(String str) { 46 setValue(str); 47 } 48 49 private void setValue(String str) { 50 if (str == null) { 51 throw new NullPointerException ("String representation of Book Identifier is null"); 52 } 53 int idx = str.indexOf(SEP); 54 if (idx == -1) { 55 throw new NullPointerException ("Bad String representation of Book Identifier: " + str); 56 } 57 isbn = Integer.valueOf(str.substring(0, idx)).intValue(); 58 type = str.substring(idx + SEP.length()); 59 } 60 61 public String toString() { 62 return isbn + SEP + type; 63 } 64 65 } 66 | Popular Tags |