Remove some redundant 'throws'; allocate more reasonably sized StringBuffers for...
[zxing.git] / core / src / com / google / zxing / client / result / AddressBookParsedResult.java
index cfefd29..7ef889c 100644 (file)
 package com.google.zxing.client.result;
 
 /**
- * @author srowen@google.com (Sean Owen)
+ * @author Sean Owen
  */
-public final class AddressBookParsedResult extends AbstractDoCoMoParsedResult {
+public final class AddressBookParsedResult extends ParsedResult {
 
   private final String[] names;
+  private final String pronunciation;
   private final String[] phoneNumbers;
   private final String[] emails;
   private final String note;
@@ -29,17 +30,21 @@ public final class AddressBookParsedResult extends AbstractDoCoMoParsedResult {
   private final String org;
   private final String birthday;
   private final String title;
+  private final String url;
 
   public AddressBookParsedResult(String[] names,
+                                 String pronunciation,
                                  String[] phoneNumbers,
                                  String[] emails,
                                  String note,
                                  String address,
                                  String org,
                                  String birthday,
-                                 String title) {
+                                 String title,
+                                 String url) {
     super(ParsedResultType.ADDRESSBOOK);
     this.names = names;
+    this.pronunciation = pronunciation;
     this.phoneNumbers = phoneNumbers;
     this.emails = emails;
     this.note = note;
@@ -47,12 +52,23 @@ public final class AddressBookParsedResult extends AbstractDoCoMoParsedResult {
     this.org = org;
     this.birthday = birthday;
     this.title = title;
+    this.url = url;
   }
 
   public String[] getNames() {
     return names;
   }
 
+  /**
+   * In Japanese, the name is written in kanji, which can have multiple readings. Therefore a hint
+   * is often provided, called furigana, which spells the name phonetically.
+   *
+   * @return The pronunciation of the getNames() field, often in hiragana or katakana.
+   */
+  public String getPronunciation() {
+    return pronunciation;
+  }
+
   public String[] getPhoneNumbers() {
     return phoneNumbers;
   }
@@ -77,21 +93,30 @@ public final class AddressBookParsedResult extends AbstractDoCoMoParsedResult {
     return org;
   }
 
+  public String getURL() {
+    return url;
+  }
+
+  /**
+   * @return birthday formatted as yyyyMMdd (e.g. 19780917)
+   */
   public String getBirthday() {
     return birthday;
   }
 
   public String getDisplayResult() {
-    StringBuffer result = new StringBuffer();
+    StringBuffer result = new StringBuffer(100);
     maybeAppend(names, result);
-    maybeAppend(emails, result);
+    maybeAppend(pronunciation, result);
+    maybeAppend(title, result);
+    maybeAppend(org, result);
     maybeAppend(address, result);
     maybeAppend(phoneNumbers, result);
-    maybeAppend(note, result);
-    maybeAppend(org, result);
+    maybeAppend(emails, result);
+    maybeAppend(url, result);
     maybeAppend(birthday, result);
-    maybeAppend(title, result);
+    maybeAppend(note, result);
     return result.toString();
   }
 
-}
\ No newline at end of file
+}