Reordered the address book fields to something a little more standard/reasonable.
[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 srowen@google.com (Sean Owen)
21  */
22 public final class AddressBookParsedResult extends ParsedResult {
23
24   private final String[] names;
25   private final String[] phoneNumbers;
26   private final String[] emails;
27   private final String note;
28   private final String address;
29   private final String org;
30   private final String birthday;
31   private final String title;
32   private final String url;
33
34   public AddressBookParsedResult(String[] names,
35                                  String[] phoneNumbers,
36                                  String[] emails,
37                                  String note,
38                                  String address,
39                                  String org,
40                                  String birthday,
41                                  String title,
42                                  String url) {
43     super(ParsedResultType.ADDRESSBOOK);
44     this.names = names;
45     this.phoneNumbers = phoneNumbers;
46     this.emails = emails;
47     this.note = note;
48     this.address = address;
49     this.org = org;
50     this.birthday = birthday;
51     this.title = title;
52     this.url = url;
53   }
54
55   public String[] getNames() {
56     return names;
57   }
58
59   public String[] getPhoneNumbers() {
60     return phoneNumbers;
61   }
62
63   public String[] getEmails() {
64     return emails;
65   }
66
67   public String getNote() {
68     return note;
69   }
70
71   public String getAddress() {
72     return address;
73   }
74
75   public String getTitle() {
76     return title;
77   }
78
79   public String getOrg() {
80     return org;
81   }
82
83   public String getURL() {
84     return url;
85   }
86
87   /**
88    * @return birthday formatted as yyyyMMdd (e.g. 19780917)
89    */
90   public String getBirthday() {
91     return birthday;
92   }
93
94   public String getDisplayResult() {
95     StringBuffer result = new StringBuffer();
96     maybeAppend(names, result);
97     maybeAppend(title, result);
98     maybeAppend(org, result);
99     maybeAppend(address, result);
100     maybeAppend(phoneNumbers, result);
101     maybeAppend(emails, result);
102     maybeAppend(url, result);
103     maybeAppend(birthday, result);
104     maybeAppend(note, result);
105     return result.toString();
106   }
107
108 }