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