Commit | Line | Data |
---|---|---|
5179fc01 | 1 | /******************************************************************************* |
61759503 | 2 | * Copyright (c) 2012, 2013 Ericsson |
063f0d27 | 3 | * |
5179fc01 FC |
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 | |
063f0d27 | 8 | * |
5179fc01 FC |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.core.event; | |
14 | ||
15 | /** | |
f7703ed6 | 16 | * The generic event payload in TMF. Each field can be either a terminal or |
4c564a2d | 17 | * further decomposed into subfields. |
063f0d27 | 18 | * |
b9e37ffd FC |
19 | * @version 1.0 |
20 | * @author Francois Chouinard | |
21 | * | |
b9e37ffd | 22 | * @see ITmfEvent |
2848c377 | 23 | * @see ITmfEventType |
5179fc01 | 24 | */ |
0316808c | 25 | public interface ITmfEventField { |
5179fc01 | 26 | |
a4115405 FC |
27 | // ------------------------------------------------------------------------ |
28 | // Constants | |
29 | // ------------------------------------------------------------------------ | |
30 | ||
4c564a2d FC |
31 | /** |
32 | * The root field id (the main container) | |
33 | */ | |
a4115405 | 34 | public static final String ROOT_FIELD_ID = ":root:"; //$NON-NLS-1$ |
085d898f | 35 | |
a4115405 FC |
36 | // ------------------------------------------------------------------------ |
37 | // Getters | |
38 | // ------------------------------------------------------------------------ | |
39 | ||
5179fc01 | 40 | /** |
d7dbf09a | 41 | * @return the field name |
5179fc01 | 42 | */ |
57a2a5ca | 43 | String getName(); |
5179fc01 FC |
44 | |
45 | /** | |
46 | * @return the field value | |
47 | */ | |
57a2a5ca | 48 | Object getValue(); |
5179fc01 | 49 | |
8f86c552 GB |
50 | /** |
51 | * @return the value formatted as string | |
52 | * @since 2.0 | |
53 | */ | |
57a2a5ca | 54 | String getFormattedValue(); |
8f86c552 | 55 | |
5179fc01 | 56 | /** |
f7703ed6 | 57 | * @return the list of subfield names (empty array if none) |
4c564a2d | 58 | */ |
57a2a5ca | 59 | String[] getFieldNames(); |
4c564a2d FC |
60 | |
61 | /** | |
063f0d27 | 62 | * @param index The index of the field |
4c564a2d FC |
63 | * @return the nth field name (null if absent or inexistent) |
64 | */ | |
57a2a5ca | 65 | String getFieldName(int index); |
4c564a2d FC |
66 | |
67 | /** | |
f7703ed6 | 68 | * @return the list of subfields (empty array if none) |
4c564a2d | 69 | */ |
57a2a5ca | 70 | ITmfEventField[] getFields(); |
4c564a2d FC |
71 | |
72 | /** | |
063f0d27 | 73 | * @param name The name of the field |
4c564a2d FC |
74 | * @return a specific subfield by name (null if absent or inexistent) |
75 | */ | |
57a2a5ca | 76 | ITmfEventField getField(String name); |
4c564a2d FC |
77 | |
78 | /** | |
063f0d27 | 79 | * @param index The index of the field to return |
4c564a2d | 80 | * @return a specific subfield by index (null if absent or inexistent) |
5179fc01 | 81 | */ |
57a2a5ca | 82 | ITmfEventField getField(int index); |
5179fc01 | 83 | |
6c204912 GB |
84 | /** |
85 | * Gets the a sub-field of this field, which may be multiple levels down. | |
86 | * | |
87 | * @param path | |
88 | * Array of field names to recursively go through | |
89 | * @return The field at the end, or null if a field in the path cannot be | |
90 | * found | |
91 | * @since 3.0 | |
92 | */ | |
93 | ITmfEventField getSubField(String[] path); | |
94 | ||
5179fc01 | 95 | } |