Commit | Line | Data |
---|---|---|
5179fc01 | 1 | /******************************************************************************* |
97de0bca | 2 | * Copyright (c) 2012, 2015 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 |
97de0bca | 12 | * Patrick Tasse - Use ellipsis for getField and remove getSubField |
5179fc01 FC |
13 | *******************************************************************************/ |
14 | ||
2bdf0193 | 15 | package org.eclipse.tracecompass.tmf.core.event; |
5179fc01 | 16 | |
b742c196 AM |
17 | import java.util.Collection; |
18 | ||
19 | import org.eclipse.jdt.annotation.NonNull; | |
20 | ||
5179fc01 | 21 | /** |
f7703ed6 | 22 | * The generic event payload in TMF. Each field can be either a terminal or |
4c564a2d | 23 | * further decomposed into subfields. |
063f0d27 | 24 | * |
b9e37ffd FC |
25 | * @version 1.0 |
26 | * @author Francois Chouinard | |
27 | * | |
b9e37ffd | 28 | * @see ITmfEvent |
2848c377 | 29 | * @see ITmfEventType |
5179fc01 | 30 | */ |
0316808c | 31 | public interface ITmfEventField { |
5179fc01 | 32 | |
a4115405 FC |
33 | // ------------------------------------------------------------------------ |
34 | // Constants | |
35 | // ------------------------------------------------------------------------ | |
36 | ||
4c564a2d FC |
37 | /** |
38 | * The root field id (the main container) | |
39 | */ | |
b742c196 | 40 | public static final @NonNull String ROOT_FIELD_ID = ":root:"; //$NON-NLS-1$ |
085d898f | 41 | |
a4115405 FC |
42 | // ------------------------------------------------------------------------ |
43 | // Getters | |
44 | // ------------------------------------------------------------------------ | |
45 | ||
5179fc01 | 46 | /** |
d7dbf09a | 47 | * @return the field name |
5179fc01 | 48 | */ |
fafdd006 | 49 | @NonNull String getName(); |
5179fc01 FC |
50 | |
51 | /** | |
52 | * @return the field value | |
53 | */ | |
57a2a5ca | 54 | Object getValue(); |
5179fc01 | 55 | |
8f86c552 GB |
56 | /** |
57 | * @return the value formatted as string | |
8f86c552 | 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) | |
4c564a2d | 66 | */ |
fafdd006 | 67 | @NonNull Collection<String> getFieldNames(); |
4c564a2d FC |
68 | |
69 | /** | |
97de0bca | 70 | * Return the subfields. The iteration order is the same as |
b742c196 AM |
71 | * {@link #getFieldNames()}. The returned Collection is immutable. |
72 | * | |
73 | * @return The subfields (empty Collection if none) | |
4c564a2d | 74 | */ |
fafdd006 | 75 | @NonNull Collection<? extends ITmfEventField> getFields(); |
4c564a2d FC |
76 | |
77 | /** | |
97de0bca PT |
78 | * Return a subfield by its path relative to this field. |
79 | * If the path is empty, this field is returned. | |
80 | * @param path The path to the subfield | |
81 | * @return a specific subfield by path (null if inexistent) | |
4c564a2d | 82 | */ |
97de0bca | 83 | ITmfEventField getField(@NonNull String... path); |
6c204912 | 84 | |
5179fc01 | 85 | } |