TMF: Have ITmfEvent#getTrace() return NonNull
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / trace / text / TextTraceEvent.java
CommitLineData
5ece050b
AM
1/*******************************************************************************
2 * Copyright (c) 2014 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 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
2bdf0193 13package org.eclipse.tracecompass.tmf.core.trace.text;
5ece050b 14
ca5b04ad 15import org.eclipse.jdt.annotation.NonNull;
2bdf0193
AM
16import org.eclipse.tracecompass.tmf.core.event.ITmfEventType;
17import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
18import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
5ece050b
AM
19
20/**
21 * Class to store the common functionality of text trace events.
22 *
23 * @author Alexandre Montplaisir
24 * @since 3.0
25 */
26public abstract class TextTraceEvent extends TmfEvent {
27
28 /**
29 * Full Constructor.
30 *
31 * Compared to {@link TmfEvent}'s constructor, 'content' is restricted to a
32 * {@link TextTraceEventContent}.
33 *
34 * @param parentTrace
35 * The parent trace
36 * @param timestamp
37 * The event timestamp
38 * @param source
39 * The event source
40 * @param type
41 * The event type
42 * @param content
43 * The event content (payload)
44 * @param reference
45 * The event reference
46 */
47 public TextTraceEvent(TextTrace<? extends TextTraceEvent> parentTrace,
48 final ITmfTimestamp timestamp,
49 final String source,
50 final ITmfEventType type,
51 final TextTraceEventContent content,
52 final String reference) {
53 super(parentTrace, timestamp, source, type, content, reference);
54 }
55
56 /**
57 * Copy constructor
58 *
59 * @param other
60 * The event to copy
61 */
ca5b04ad 62 public TextTraceEvent(final @NonNull TextTraceEvent other) {
5ece050b
AM
63 super(other);
64 }
65
66 @Override
67 public TextTrace<? extends TextTraceEvent> getTrace() {
68 /* Cast should be safe, type is restricted by the constructor */
69 return (TextTrace<?>) super.getTrace();
70 }
71
72 @Override
73 public TextTraceEventContent getContent() {
74 /* Cast should be safe, type is restricted by the constructor */
75 return (TextTraceEventContent) super.getContent();
76 }
77}
This page took 0.038117 seconds and 5 git commands to generate.