Commit | Line | Data |
---|---|---|
a52fde77 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 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 | |
11 | ******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.core.statevalue; | |
14 | ||
15 | ||
16 | /** | |
17 | * This is the interface for using state values and reading their contents. | |
18 | * | |
19 | * @author alexmont | |
20 | * | |
21 | */ | |
22 | public interface ITmfStateValue { | |
23 | ||
24 | /** | |
25 | * Each implementation has to supply a "type" number. This will get written | |
26 | * as-is in the History file to recognize the type, so it needs to be unique | |
27 | * | |
28 | * @return The unique "int8" assigned to this state value type | |
29 | */ | |
30 | public byte getType(); | |
31 | ||
32 | /** | |
33 | * Only "null values" should return true here | |
34 | * | |
35 | * @return True if this type of SV is considered "null", false if it | |
36 | * contains a real value. | |
37 | */ | |
38 | public boolean isNull(); | |
39 | ||
40 | /** | |
41 | * Read the contained value as an 'int' primitive | |
42 | * | |
43 | * @return The integer contained in the state value | |
44 | * @throws StateValueTypeException | |
45 | * If the contained value cannot be read as an integer | |
46 | */ | |
47 | public int unboxInt() throws StateValueTypeException; | |
48 | ||
49 | /** | |
50 | * Read the contained value as a String | |
51 | * | |
52 | * @return The String contained in the state value | |
53 | * @throws StateValueTypeException | |
54 | * If the contained value cannot be read as a String | |
55 | */ | |
56 | public String unboxStr() throws StateValueTypeException; | |
57 | } |