Support SMTP URLs
[zxing.git] / core / src / com / google / zxing / client / result / AddressBookParsedResult.java
1 /*
2  * Copyright 2007 ZXing authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.google.zxing.client.result;
18
19 /**
20  * @author Sean Owen
21  */
22 public final class AddressBookParsedResult extends ParsedResult {
23
24   private final String[] names;
25   private final String pronunciation;
26   private final String[] phoneNumbers;
27   private final String[] emails;
28   private final String note;
29   private final String[] addresses;
30   private final String org;
31   private final String birthday;
32   private final String title;
33   private final String url;
34
35   public AddressBookParsedResult(String[] names,
36                                  String pronunciation,
37                                  String[] phoneNumbers,
38                                  String[] emails,
39                                  String note,
40                                  String[] addresses,
41                                  String org,
42                                  String birthday,
43                                  String title,
44                                  String url) {
45     super(ParsedResultType.ADDRESSBOOK);
46     this.names = names;
47     this.pronunciation = pronunciation;
48     this.phoneNumbers = phoneNumbers;
49     this.emails = emails;
50     this.note = note;
51     this.addresses = addresses;
52     this.org = org;
53     this.birthday = birthday;
54     this.title = title;
55     this.url = url;
56   }
57
58   public String[] getNames() {
59     return names;
60   }
61
62   /**
63    * In Japanese, the name is written in kanji, which can have multiple readings. Therefore a hint
64    * is often provided, called furigana, which spells the name phonetically.
65    *
66    * @return The pronunciation of the getNames() field, often in hiragana or katakana.
67    */
68   public String getPronunciation() {
69     return pronunciation;
70   }
71
72   public String[] getPhoneNumbers() {
73     return phoneNumbers;
74   }
75
76   public String[] getEmails() {
77     return emails;
78   }
79
80   public String getNote() {
81     return note;
82   }
83
84   public String[] getAddresses() {
85     return addresses;
86   }
87
88   public String getTitle() {
89     return title;
90   }
91
92   public String getOrg() {
93     return org;
94   }
95
96   public String getURL() {
97     return url;
98   }
99
100   /**
101    * @return birthday formatted as yyyyMMdd (e.g. 19780917)
102    */
103   public String getBirthday() {
104     return birthday;
105   }
106
107   public String getDisplayResult() {
108     StringBuffer result = new StringBuffer(100);
109     maybeAppend(names, result);
110     maybeAppend(pronunciation, result);
111     maybeAppend(title, result);
112     maybeAppend(org, result);
113     maybeAppend(addresses, result);
114     maybeAppend(phoneNumbers, result);
115     maybeAppend(emails, result);
116     maybeAppend(url, result);
117     maybeAppend(birthday, result);
118     maybeAppend(note, result);
119     return result.toString();
120   }
121
122 }