Commit | Line | Data |
---|---|---|
5d10d135 ASL |
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.event; | |
14 | ||
3fbd810a | 15 | import org.eclipse.linuxtools.tmf.event.TmfEventField; |
5d10d135 ASL |
16 | |
17 | /** | |
07d9e2ee FC |
18 | * <b><u>LttngEventField</u></b><p> |
19 | * | |
20 | * Lttng specific implementation of the TmfEventField.<p> | |
21 | * | |
22 | * LttngEventField add a "name" attribute to the Tmf implementation This | |
3fbd810a | 23 | * mean the fields will have a name and a value. |
5d10d135 | 24 | */ |
3fbd810a FC |
25 | public class LttngEventField extends TmfEventField { |
26 | private String fieldName = ""; | |
07d9e2ee | 27 | |
3fbd810a | 28 | /** |
07d9e2ee | 29 | * Constructor with parameters.<p> |
3fbd810a | 30 | * |
07d9e2ee FC |
31 | * @param name Name of the field |
32 | * @param newContent ParsedContent we want to populate the field with. | |
3fbd810a | 33 | * |
07d9e2ee | 34 | * @see org.eclipse.linuxtools.lttng.jni.JniParser |
3fbd810a FC |
35 | */ |
36 | public LttngEventField(String name, Object newContent) { | |
37 | super(newContent); | |
38 | ||
39 | fieldName = name; | |
40 | } | |
07d9e2ee | 41 | |
3fbd810a | 42 | /** |
07d9e2ee | 43 | * Copy constructor.<p> |
3fbd810a | 44 | * |
07d9e2ee | 45 | * @param oldField the field to copy from |
3fbd810a FC |
46 | */ |
47 | public LttngEventField(LttngEventField oldField) { | |
48 | this(oldField.fieldName, oldField.getValue()); | |
49 | } | |
07d9e2ee FC |
50 | |
51 | ||
3fbd810a FC |
52 | public String getName() { |
53 | return fieldName; | |
54 | } | |
55 | ||
56 | /** | |
07d9e2ee FC |
57 | * toString() method.<p> |
58 | * | |
59 | * Print both field name and value (i.e. NAME:VALUE ). | |
3fbd810a FC |
60 | */ |
61 | @Override | |
62 | public String toString() { | |
63 | return fieldName + ":" + getValue().toString(); | |
64 | } | |
65 | } |