summaryrefslogtreecommitdiff
path: root/src/com/google/wireless/gdata/contacts/data/Organization.java
blob: ed6736b00469f8065a085928343b9a080f1bc70c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.google.wireless.gdata.contacts.data;

import com.google.wireless.gdata.parser.ParseException;

/** The Organization GData type. */
public class Organization extends ContactsElement {
  public static final byte TYPE_WORK = 1;
  public static final byte TYPE_OTHER = 2;

  private String name;
  private String title;

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getTitle() {
    return title;
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public void toString(StringBuffer sb) {
    sb.append("Organization");
    super.toString(sb);
    if (name != null) sb.append(" name:").append(name);
    if (title != null) sb.append(" title:").append(title);
  }

  public void validate() throws ParseException {
    super.validate();

    if (name == null && title == null) {
      throw new ParseException("at least one of name or title must be present");
    }
  }
}