git://git.nikiroo.be
/
jvcard.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New SAVE_TO option
[jvcard.git]
/
src
/
be
/
nikiroo
/
jvcard
/
TypeInfo.java
diff --git
a/src/be/nikiroo/jvcard/TypeInfo.java
b/src/be/nikiroo/jvcard/TypeInfo.java
index 760f75ce54caa9bfe711ea56a368954bcb2843d0..c172996bdb64e939a1718787ac48111a3e4aa87c 100644
(file)
--- a/
src/be/nikiroo/jvcard/TypeInfo.java
+++ b/
src/be/nikiroo/jvcard/TypeInfo.java
@@
-6,24
+6,59
@@
package be.nikiroo.jvcard;
* @author niki
*
*/
* @author niki
*
*/
-@SuppressWarnings("rawtypes") // expected
-public class TypeInfo extends BaseClass {
+public class TypeInfo extends BaseClass<TypeInfo> {
private String name;
private String value;
private String name;
private String value;
- @SuppressWarnings("unchecked") // expected
+ /**
+ * Create a new {@link TypeInfo}.
+ *
+ * @param name
+ * the name of this {@link TypeInfo} (<b>MUST NOT</b> be NULL)
+ * @param value
+ * its value (<b>MUST NOT</b> be NULL)
+ */
public TypeInfo(String name, String value) {
super(null);
public TypeInfo(String name, String value) {
super(null);
- this.name = name;
- this.value =
value;
+ this.name = name
.toUpperCase()
;
+ this.value =
escape(value.toString()); // crash NOW if null
}
}
+ /**
+ * Return the name.
+ *
+ * @return the name
+ */
public String getName() {
return name;
}
public String getName() {
return name;
}
+ /**
+ * Return the value.
+ *
+ * @return the value
+ */
public String getValue() {
public String getValue() {
+ return unescape(value);
+ }
+
+ /**
+ * Return the RAW value
+ *
+ * @return the RAW value
+ */
+ public String getRawValue() {
return value;
}
return value;
}
-}
\ No newline at end of file
+
+ @Override
+ public String getId() {
+ return "" + name;
+ }
+
+ @Override
+ public String getState() {
+ return ("" + name + value).replace(' ', '_');
+ }
+}