Refactor TmfEventType and TmfEventField
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.core / src / org / eclipse / linuxtools / lttng / core / event / LttngEventField.java
1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * William Bourque (wbourque@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng.core.event;
14
15 import org.eclipse.linuxtools.tmf.core.event.TmfEventContent;
16 import org.eclipse.linuxtools.tmf.core.event.TmfEventField;
17
18 /**
19 * <b><u>LttngEventField</u></b><p>
20 *
21 * Lttng specific implementation of the TmfEventField.<p>
22 *
23 * LttngEventField add a "name" attribute to the Tmf implementation This
24 * mean the fields will have a name and a value.
25 */
26 public class LttngEventField extends TmfEventField {
27
28 /**
29 * Constructor with parameters.<p>
30 *
31 * @param parent Parent content for this field
32 * @param id Name (label) of this field
33 */
34 public LttngEventField(TmfEventContent parent, String id) {
35 super(parent, id, null);
36 }
37
38 /**
39 * Constructor with parameters with optional value.<p>
40 *
41 * @param parent Parent content for this field
42 * @param id Name (label) of this field
43 * @param value Parsed value (payload) of this field
44 */
45 public LttngEventField(TmfEventContent parent, String id, Object value) {
46 super(parent, id, value);
47 }
48
49 /**
50 * Copy constructor.<p>
51 *
52 * @param oldField the field to copy from
53 */
54 public LttngEventField(LttngEventField oldField) {
55 this(oldField.getContent(), oldField.getId(), oldField.getValue());
56 }
57
58 @Override
59 @SuppressWarnings("nls")
60 public String toString() {
61 Object value = getValue();
62 return getId() + ":" + ((value != null) ? value.toString() : "null");
63 }
64
65 @Override
66 public LttngEventField clone() {
67 LttngEventField clone = (LttngEventField) super.clone();
68 clone.fValue = fValue;
69 return clone;
70 }
71
72 }
This page took 0.031656 seconds and 5 git commands to generate.