View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at 
7    * 
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software 
11   * distributed under the License is distributed on an "AS IS" BASIS, 
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  
17  package org.apache.jdo.impl.model.java;
18  
19  import org.apache.jdo.model.java.JavaType;
20  
21  /***
22   * A ValueClassType instance represents a class whoses values may be treated
23   * as values rather than refernces during storing. 
24   * <p>
25   * Class PredefinedType provides public static final variables referring
26   * to the JavaType representation for value class types.
27   * 
28   * @see PredefinedType#numberType
29   * @see PredefinedType#stringType
30   * @see PredefinedType#localeType 
31   * @see PredefinedType#bigDecimalType
32   * @see PredefinedType#bigIntegerType
33   *
34   * @author Michael Bouschen
35   * @since JDO 1.0.1
36   */
37  public class ValueClassType 
38      extends PredefinedType
39  {
40      /*** The orderable property. */
41      private boolean orderable;
42  
43      /*** 
44       * Constructor.
45       * @param clazz the Class instance representing the type
46       * @param superclass JavaType instance representing the superclass.
47       * @param orderable flag indicating whether this type is orderable.
48       */
49      public ValueClassType(Class clazz, JavaType superclass, boolean orderable)
50      {
51          super(clazz, superclass);
52          this.orderable = orderable;
53      }
54  
55      /*** 
56       * Returns <code>true</code> if this JavaType represents a type whoses
57       * values may be treated as values rather than refernces during
58       * storing.
59       * @return <code>true</code> if this JavaType represents a value type;
60       * <code>false</code> otherwise.
61       */
62      public boolean isValue() 
63      {
64          return true;
65      }
66  
67      /***
68       * Returns <code>true</code> if this JavaType represents an orderable
69       * type as specified by JDO.
70       * @return <code>true</code> if this JavaType represents an orderable
71       * type; <code>false</code> otherwise.
72       */
73      public boolean isOrderable()
74      {
75          return orderable;
76      }
77      
78  }