jDoc, possible leak on crash, new depth option
[jvcard.git] / src / be / nikiroo / jvcard / TypeInfo.java
CommitLineData
a3b510ab
NR
1package be.nikiroo.jvcard;
2
26d2bd05
NR
3/**
4 * This class describes a type, that is, a key-value pair.
5 *
6 * @author niki
26d2bd05 7 */
08fbe0fb 8public class TypeInfo extends BaseClass<TypeInfo> {
a3b510ab
NR
9 private String name;
10 private String value;
11
1c03abaf
NR
12 /**
13 * Create a new {@link TypeInfo}.
14 *
15 * @param name
16 * the name of this {@link TypeInfo} (<b>MUST NOT</b> be NULL)
17 * @param value
18 * its value (<b>MUST NOT</b> be NULL)
19 */
a3b510ab 20 public TypeInfo(String name, String value) {
26d2bd05
NR
21 super(null);
22
1c03abaf 23 this.name = name.toUpperCase();
aecb3399 24 this.value = escape(value.toString()); // crash NOW if null
a3b510ab
NR
25 }
26
1c03abaf
NR
27 /**
28 * Return the name.
29 *
30 * @return the name
31 */
a3b510ab
NR
32 public String getName() {
33 return name;
34 }
35
1c03abaf
NR
36 /**
37 * Return the value.
38 *
39 * @return the value
40 */
a3b510ab 41 public String getValue() {
aecb3399
NR
42 return unescape(value);
43 }
44
45 /**
46 * Return the RAW value
47 *
48 * @return the RAW value
49 */
50 public String getRawValue() {
a3b510ab
NR
51 return value;
52 }
e253bd50
NR
53
54 @Override
55 public String getId() {
56 return "" + name;
57 }
58
59 @Override
60 public String getState() {
e4444b0b 61 return ("" + name + value).replace(' ', '_');
e253bd50 62 }
08fbe0fb 63}