1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.jdt.internal.debug.core.model;
15 
16 import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
17 
18 import com.sun.jdi.PrimitiveValue;
19 import com.sun.jdi.Value;
20 
21 /**
22  * A primitive value on a Java debug target
23  */
24 public class JDIPrimitiveValue extends JDIValue implements IJavaPrimitiveValue {
25 
26 	/**
27 	 * Constructs a new primitive value.
28 	 *
29 	 * @param target
30 	 *            the Java debug target
31 	 * @param value
32 	 *            the underlying JDI primitive value
33 	 */
JDIPrimitiveValue(JDIDebugTarget target, Value value)34 	public JDIPrimitiveValue(JDIDebugTarget target, Value value) {
35 		super(target, value);
36 	}
37 
38 	/**
39 	 * Returns this value's underlying primtive value
40 	 *
41 	 * @return underlying primtive value
42 	 */
getUnderlyingPrimitiveValue()43 	protected PrimitiveValue getUnderlyingPrimitiveValue() {
44 		return (PrimitiveValue) getUnderlyingValue();
45 	}
46 
47 	/*
48 	 * @see IJavaPrimitiveValue#getBooleanValue()
49 	 */
50 	@Override
getBooleanValue()51 	public boolean getBooleanValue() {
52 		return getUnderlyingPrimitiveValue().booleanValue();
53 	}
54 
55 	/*
56 	 * @see IJavaPrimitiveValue#getByteValue()
57 	 */
58 	@Override
getByteValue()59 	public byte getByteValue() {
60 		return getUnderlyingPrimitiveValue().byteValue();
61 	}
62 
63 	/*
64 	 * @see IJavaPrimitiveValue#getCharValue()
65 	 */
66 	@Override
getCharValue()67 	public char getCharValue() {
68 		return getUnderlyingPrimitiveValue().charValue();
69 	}
70 
71 	/*
72 	 * @see IJavaPrimitiveValue#getDoubleValue()
73 	 */
74 	@Override
getDoubleValue()75 	public double getDoubleValue() {
76 		return getUnderlyingPrimitiveValue().doubleValue();
77 	}
78 
79 	/*
80 	 * @see IJavaPrimitiveValue#getFloatValue()
81 	 */
82 	@Override
getFloatValue()83 	public float getFloatValue() {
84 		return getUnderlyingPrimitiveValue().floatValue();
85 	}
86 
87 	/*
88 	 * @see IJavaPrimitiveValue#getIntValue()
89 	 */
90 	@Override
getIntValue()91 	public int getIntValue() {
92 		return getUnderlyingPrimitiveValue().intValue();
93 	}
94 
95 	/*
96 	 * @see IJavaPrimitiveValue#getLongValue()
97 	 */
98 	@Override
getLongValue()99 	public long getLongValue() {
100 		return getUnderlyingPrimitiveValue().longValue();
101 	}
102 
103 	/*
104 	 * @see IJavaPrimitiveValue#getShortValue()
105 	 */
106 	@Override
getShortValue()107 	public short getShortValue() {
108 		return getUnderlyingPrimitiveValue().shortValue();
109 	}
110 
111 }
112