1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jdo.impl.model.java;
18
19 import org.apache.jdo.model.java.JavaType;
20
21 /***
22 * A PrimitiveType instance represents a primitive type as defined in the
23 * Java language. There are eight primitive types: <code>boolean</code>,
24 * <code>byte</code>, <code>short</code>, <code>int</code>,
25 * <code>long</code>, <code>char</code>,
26 * <code>float</code>, <code>double</code>.
27 * <p>
28 * Class PredefinedType provides public static final variables referring
29 * to the JavaType representation for primtive types.
30 *
31 * @see PredefinedType#booleanType
32 * @see PredefinedType#byteType
33 * @see PredefinedType#shortType
34 * @see PredefinedType#intType
35 * @see PredefinedType#longType
36 * @see PredefinedType#charType
37 * @see PredefinedType#floatType
38 * @see PredefinedType#doubleType
39 *
40 * @author Michael Bouschen
41 * @since JDO 1.0.1
42 */
43 public class PrimitiveType
44 extends PredefinedType
45 {
46 /*** The JavaType of the corresponding Java wrapper class type. */
47 private WrapperClassType wrapperClassType;
48
49 /***
50 * Constructor.
51 * @param clazz the Class instance representing the type
52 */
53 protected PrimitiveType(Class clazz)
54 {
55 super(clazz, null);
56 }
57
58 /***
59 * Returns <code>true</code> if this JavaType represents a primitive
60 * type.
61 * @return <code>true</code> if this JavaTypre represents a primitive
62 * type; <code>false</code> otherwise.
63 */
64 public boolean isPrimitive()
65 {
66 return true;
67 }
68
69 /***
70 * Returns <code>true</code> if this JavaType represents a type whoses
71 * values may be treated as values rather than refernces during
72 * storing.
73 * @return <code>true</code> if this JavaType represents a value type;
74 * <code>false</code> otherwise.
75 */
76 public boolean isValue()
77 {
78 return true;
79 }
80
81
82
83 /***
84 * Returns the JavaType instance of the Java wrapper class that
85 * corresponds to this primitive type.
86 * @return the JavaType of the corresponding Java wrapper class.
87 */
88 public WrapperClassType getWrapperClassType()
89 {
90 return wrapperClassType;
91 }
92
93 /***
94 * Sets the JavaType instance of the corresponding Java wrapper class.
95 * @param wrapperClassType the JavaType representing the corresponding
96 * Java wrapper class.
97 */
98 void setWrapperClassType(WrapperClassType wrapperClassType)
99 {
100 this.wrapperClassType = wrapperClassType;
101 }
102
103 }