tmf: Replace state value types with an enum
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / statevalue / ITmfStateValue.java
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 import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
16
17
18 /**
19 * This is the interface for using state values and reading their contents.
20 *
21 * @version 1.0
22 * @author Alexandre Montplaisir
23 */
24 public interface ITmfStateValue {
25
26 /**
27 * The supported types of state values
28 * @since 2.0
29 */
30 public enum Type {
31 /** Null value, for an interval not carrying any information */
32 NULL,
33 /** 32-bit integer value */
34 INTEGER,
35 /** Variable-length string value */
36 STRING
37 }
38
39 /**
40 * Each implementation has to define which one (among the supported types)
41 * they implement. There could be more than one implementation of each type,
42 * depending on the needs of the different users.
43 *
44 * @return The ITmfStateValue.Type enum representing the type of this value
45 * @since 2.0
46 */
47 public Type getType();
48
49 /**
50 * Only "null values" should return true here
51 *
52 * @return True if this type of SV is considered "null", false if it
53 * contains a real value.
54 */
55 public boolean isNull();
56
57 /**
58 * Read the contained value as an 'int' primitive
59 *
60 * @return The integer contained in the state value
61 * @throws StateValueTypeException
62 * If the contained value cannot be read as an integer
63 */
64 public int unboxInt() throws StateValueTypeException;
65
66 /**
67 * Read the contained value as a String
68 *
69 * @return The String contained in the state value
70 * @throws StateValueTypeException
71 * If the contained value cannot be read as a String
72 */
73 public String unboxStr() throws StateValueTypeException;
74 }
This page took 0.032537 seconds and 5 git commands to generate.