X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2FTypeInfo.java;h=c5b812cc89939ae556f3b62f48bb7c234ce6ac11;hb=e4444b0bc462544629d9e7e7ab62b96a4d9cab10;hp=760f75ce54caa9bfe711ea56a368954bcb2843d0;hpb=26d2bd0591901a8d52bd24802a8d6827d0e9b833;p=jvcard.git
diff --git a/src/be/nikiroo/jvcard/TypeInfo.java b/src/be/nikiroo/jvcard/TypeInfo.java
index 760f75c..c5b812c 100644
--- a/src/be/nikiroo/jvcard/TypeInfo.java
+++ b/src/be/nikiroo/jvcard/TypeInfo.java
@@ -6,24 +6,52 @@ package be.nikiroo.jvcard;
* @author niki
*
*/
-@SuppressWarnings("rawtypes") // expected
+@SuppressWarnings("rawtypes")
public class TypeInfo extends BaseClass {
private String name;
private String value;
- @SuppressWarnings("unchecked") // expected
+ /**
+ * Create a new {@link TypeInfo}.
+ *
+ * @param name
+ * the name of this {@link TypeInfo} (MUST NOT be NULL)
+ * @param value
+ * its value (MUST NOT be NULL)
+ */
+ @SuppressWarnings("unchecked")
public TypeInfo(String name, String value) {
super(null);
- this.name = name;
- this.value = value;
+ this.name = name.toUpperCase();
+ this.value = value.toString(); // crash NOW if null
}
+ /**
+ * Return the name.
+ *
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Return the value.
+ *
+ * @return the value
+ */
public String getValue() {
return value;
}
+
+ @Override
+ public String getId() {
+ return "" + name;
+ }
+
+ @Override
+ public String getState() {
+ return ("" + name + value).replace(' ', '_');
+ }
}
\ No newline at end of file