X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2FTypeInfo.java;h=847cc25189a65ee1e58291fce5d7813193b11e83;hb=08fbe0fb5e86bc7f1bec0a0b9e2d06290a70b212;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..847cc25 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 -public class TypeInfo extends BaseClass { +@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; } -} \ No newline at end of file + + @Override + public String getId() { + return "" + name; + } + + @Override + public String getState() { + return ("" + name + value).replace(' ', '_'); + } +}