* <b><u>TmfEventField</u></b>
* <p>
* A basic event field.
+ *
+ * TODO: Add support for field hierarchy.
*/
-public class TmfEventField {
+public class TmfEventField implements Cloneable {
// ========================================================================
// Attributes
// ========================================================================
- private final Object fValue;
+ private final TmfEventContent fParent;
+ private final String fFieldId;
+ private Object fValue;
// ========================================================================
// Constructors
// ========================================================================
/**
+ * @param parent
+ * @param id
* @param value
*/
- public TmfEventField(Object value) {
- fValue = value;
+ public TmfEventField(TmfEventContent parent, String id, Object value) {
+ fParent = parent;
+ fFieldId = id;
+ fValue = value;
+ }
+
+ /**
+ * @param other
+ */
+ public TmfEventField(TmfEventField other) {
+ assert(other != null);
+ fParent = other.fParent;
+ fFieldId = other.fFieldId;
+ fValue = other.fValue;
+ }
+
+ @SuppressWarnings("unused")
+ private TmfEventField() {
+ fParent = null;
+ fFieldId = null;
+ fValue = null;
}
// ========================================================================
// Accessors
// ========================================================================
+ /**
+ * @return
+ */
+ public TmfEventContent getParent() {
+ return fParent;
+ }
+
+ /**
+ * @return
+ */
+ public String getId() {
+ return fFieldId;
+ }
+
/**
* @return
*/
return fValue;
}
+ /**
+ * @param value
+ */
+ protected void setValue(Object value) {
+ fValue = value;
+ }
+
// ========================================================================
// Operators
// ========================================================================
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ /**
+ * Clone: shallow copy by default; override for deep copy.
+ */
+ @Override
+ public TmfEventField clone() {
+ return new TmfEventField(this);
+ }
+
@Override
public String toString() {
- return fValue.toString();
+ return "[TmfEventField(" + fFieldId + ":" + fValue.toString() + ")]";
}
-}
+}
\ No newline at end of file