X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2FTypeInfo.java;h=847cc25189a65ee1e58291fce5d7813193b11e83;hb=08fbe0fb5e86bc7f1bec0a0b9e2d06290a70b212;hp=b3851b20e5cbca48437185c71696bd0857bc5407;hpb=ce822a7cd8ff95a031e477e37d23c114228cc5b6;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/TypeInfo.java b/src/be/nikiroo/jvcard/TypeInfo.java index b3851b2..847cc25 100644 --- a/src/be/nikiroo/jvcard/TypeInfo.java +++ b/src/be/nikiroo/jvcard/TypeInfo.java @@ -1,19 +1,57 @@ package be.nikiroo.jvcard; -public class TypeInfo { +/** + * This class describes a type, that is, a key-value pair. + * + * @author niki + * + */ +@SuppressWarnings("rawtypes") +public class TypeInfo extends BaseClass { private String name; private String value; + /** + * 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) { - this.name = name; - this.value = value; + super(null); + + 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(' ', '_'); + } +}