1 /*
2 * JBoss, the OpenSource J2EE webOS
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */
7 package javax.management;
8
9 /**
10 * A Number that is an arguement to a query.<p>
11 *
12 * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
13 * @version $Revision: 1.3 $
14 */
15 /*package*/ class NumberValueExp
16 extends SingleValueExpSupport
17 {
18 // Constants ---------------------------------------------------
19
20 // Attributes --------------------------------------------------
21
22 // Static -----------------------------------------------------
23
24 // Constructors ------------------------------------------------
25
26 /**
27 * Construct a number value expression for the passed number
28 *
29 * @param value the value of number
30 */
31 public NumberValueExp(Number value)
32 {
33 super(value);
34 }
35
36 // Public ------------------------------------------------------
37
38 /**
39 * Test whether the type is integer
40 */
41 public boolean isInteger()
42 {
43 Object value = getValue();
44 return value instanceof Integer || value instanceof Long;
45 }
46
47 /**
48 * Get the value of this number (integers)
49 */
50 public double getLongValue()
51 {
52 return ((Number)getValue()).longValue();
53 }
54
55 /**
56 * Get the value of this number (floating)
57 */
58 public double getDoubleValue()
59 {
60 return ((Number)getValue()).doubleValue();
61 }
62
63 // X Implementation --------------------------------------------
64
65 // Y overrides -------------------------------------------------
66
67 // Protected ---------------------------------------------------
68
69 // Package Private ---------------------------------------------
70
71 // Private -----------------------------------------------------
72
73 // Inner Classes -----------------------------------------------
74 }