Update usage of IAdaptable#getAdapter
[deliverable/tracecompass.git] / btf / org.eclipse.tracecompass.btf.core / src / org / eclipse / tracecompass / btf / core / event / BtfEvent.java
CommitLineData
ff71e543 1/*******************************************************************************
df854ddb 2 * Copyright (c) 2014, 2015 Ericsson
ff71e543
MK
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 * Matthew Khouzam - Initial API and implementation
df854ddb 11 * Patrick Tasse - Rename reference to target
ff71e543
MK
12 *******************************************************************************/
13
7ce90559 14package org.eclipse.tracecompass.btf.core.event;
ff71e543 15
df854ddb 16import org.eclipse.core.runtime.Platform;
2bdf0193
AM
17import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
18import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
19import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
20import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
21import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
ff71e543
MK
22
23/**
df854ddb
PT
24 * A Btf event, basically a wrapper for the TmfEvent with the additional fields
25 * source, target and description.
ff71e543
MK
26 *
27 * @author Matthew Khouzam
28 */
29public class BtfEvent extends TmfEvent {
30
31 private final String fDescription;
e1de2fd4 32 private final String fSource;
df854ddb 33 private final String fTarget;
ff71e543
MK
34
35 /**
36 * Standard constructor.
37 *
38 * @param trace
39 * the parent trace
40 * @param rank
41 * the event rank
42 * @param timestamp
43 * the event timestamp
44 * @param source
45 * the event source
46 * @param type
47 * the event type
48 * @param description
49 * a description of the type
50 * @param content
51 * the event content (payload)
df854ddb 52 * @param target
ff71e543
MK
53 * the event reference
54 */
e1de2fd4
AM
55 public BtfEvent(final ITmfTrace trace,
56 final long rank,
57 final ITmfTimestamp timestamp,
58 final String source,
59 final ITmfEventType type,
60 final String description,
61 final ITmfEventField content,
df854ddb 62 final String target) {
e1de2fd4 63 super(trace, rank, timestamp, type, content);
ff71e543 64 fDescription = description;
e1de2fd4 65 fSource = source;
df854ddb 66 fTarget = target;
ff71e543
MK
67 }
68
69 /**
70 * Gets a description
71 *
72 * @return the description
73 */
74 public String getEventDescription() {
75 return fDescription;
76 }
77
df854ddb 78 @Override
e58fe1d5 79 public <T> T getAdapter(Class<T> adapterType) {
df854ddb 80 // Force loading the adapters otherwise some plugins might not load
e58fe1d5
AM
81 Object adatper = Platform.getAdapterManager().loadAdapter(this, adapterType.getName());
82 return adapterType.cast(adatper);
df854ddb
PT
83 }
84
e1de2fd4
AM
85 /**
86 * Returns the source of this event.
87 *
88 * @return This event's source
89 */
90 public String getSource() {
91 return fSource;
92 }
93
94 /**
df854ddb 95 * Returns the target of this event.
e1de2fd4 96 *
df854ddb 97 * @return This event's target
e1de2fd4 98 */
df854ddb
PT
99 public String getTarget() {
100 return fTarget;
e1de2fd4 101 }
ff71e543 102}
This page took 0.045503 seconds and 5 git commands to generate.