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
Add more warnings source to 1.6) and fix warnings
[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 26314fa48a016603a9b3d9066a8d6d59f13a2c90..c172996bdb64e939a1718787ac48111a3e4aa87c 100644
(file)
--- a/
src/be/nikiroo/jvcard/TypeInfo.java
+++ b/
src/be/nikiroo/jvcard/TypeInfo.java
@@
-1,58
+1,64
@@
package be.nikiroo.jvcard;
package be.nikiroo.jvcard;
-public class TypeInfo {
+/**
+ * This class describes a type, that is, a key-value pair.
+ *
+ * @author niki
+ *
+ */
+public class TypeInfo extends BaseClass<TypeInfo> {
private String name;
private String value;
private String name;
private String value;
- private Data parent;
- private boolean dirty;
+ /**
+ * 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) {
public TypeInfo(String name, String value) {
- this.name = name;
- this.value = value;
+ super(null);
+
+ 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;
}
- public String getValue() {
- return value;
- }
-
/**
/**
- *
Check if this {@link TypeInfo} has unsaved changes
.
+ *
Return the value
.
*
*
- * @return
TRUE if it has
+ * @return
the value
*/
*/
- public
boolean isDirty
() {
- return
dirty
;
+ public
String getValue
() {
+ return
unescape(value)
;
}
/**
}
/**
- * Notify that this element has unsaved changes, and notify its parent of
- * the same if any.
+ * Return the RAW value
+ *
+ * @return the RAW value
*/
*/
- protected void setDirty() {
- this.dirty = true;
- if (this.parent != null)
- this.parent.setDirty();
+ public String getRawValue() {
+ return value;
}
}
- /**
- * Notify this element <i>and all its descendants</i> that it is in pristine
- * state (as opposed to dirty).
- */
- void setPristine() {
- dirty = false;
+ @Override
+ public String getId() {
+ return "" + name;
}
}
- /**
- * Set the parent of this {@link TypeInfo}.
- *
- * @param parent
- * the new parent
- */
- void setParent(Data parent) {
- this.parent = parent;
+ @Override
+ public String getState() {
+ return ("" + name + value).replace(' ', '_');
}
}
-}
\ No newline at end of file
+}