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