Commit | Line | Data |
---|---|---|
a52fde77 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012 Ericsson | |
3 | * Copyright (c) 2010, 2011 École Polytechnique de Montréal | |
4 | * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com> | |
2cb26548 | 5 | * |
a52fde77 AM |
6 | * All rights reserved. This program and the accompanying materials are |
7 | * made available under the terms of the Eclipse Public License v1.0 which | |
8 | * accompanies this distribution, and is available at | |
9 | * http://www.eclipse.org/legal/epl-v10.html | |
2cb26548 | 10 | * |
a52fde77 AM |
11 | *******************************************************************************/ |
12 | ||
13 | package org.eclipse.linuxtools.tmf.core.statevalue; | |
14 | ||
15 | /** | |
16 | * A state value that contains no particular value. It is sometimes needed over | |
17 | * a "null" reference, since we avoid NPE's this way. | |
2cb26548 | 18 | * |
a52fde77 | 19 | * It can also be read either as a String ("nullValue") or an Integer (-1). |
a52fde77 | 20 | * |
2cb26548 AM |
21 | * @version 1.0 |
22 | * @author Alexandre Montplaisir | |
a52fde77 AM |
23 | */ |
24 | final class NullStateValue extends TmfStateValue { | |
25 | ||
26 | @Override | |
27 | public byte getType() { | |
0e05a268 | 28 | return ITmfStateValue.TYPE_NULL; |
a52fde77 AM |
29 | } |
30 | ||
31 | @Override | |
32 | public boolean isNull() { | |
33 | return true; | |
34 | } | |
35 | ||
36 | @Override | |
37 | public Object getValue() { | |
38 | return null; | |
39 | } | |
40 | ||
41 | @Override | |
42 | public byte[] toByteArray() { | |
43 | return null; | |
44 | } | |
45 | ||
46 | @Override | |
47 | public String toString() { | |
48 | return "nullValue"; //$NON-NLS-1$ | |
49 | } | |
50 | } |