View Javadoc

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