summaryrefslogtreecommitdiff
path: root/src/com/google/wireless/gdata/data/ExtendedProperty.java
blob: 92e2c2b26b2749807ea6b88c799aa577372d4274 (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
44
45
46
47
48
49
50
51
52
53
package com.google.wireless.gdata.data;

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

/**
 * The extendedProperty gdata type
 */
public class ExtendedProperty {
  private String name;
  private String value;
  private String xmlBlob;

  public String getXmlBlob() {
    return xmlBlob;
  }

  public void setXmlBlob(String xmlBlob) {
    this.xmlBlob = xmlBlob;
  }

  public String getName() {
    return name;
  }

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

  public String getValue() {
    return value;
  }

  public void setValue(String value) {
    this.value = value;
  }

  public void toString(StringBuffer sb) {
    sb.append("ExtendedProperty");
    if (name != null) sb.append(" name:").append(name);
    if (value != null) sb.append(" value:").append(value);
    if (xmlBlob != null) sb.append(" xmlBlob:").append(xmlBlob);
  }

  public void validate() throws ParseException {
    if (name == null) {
      throw new ParseException("name must not be null");
    }

    if ((value == null && xmlBlob == null) || (value != null && xmlBlob != null)) {
      throw new ParseException("exactly one of value and xmlBlob must be present");
    }
  }
}