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 JDOSupportedCollectionType instance represents a JDO supported
23   * collection type. 
24   * <p>
25   * Class PredefinedType provides public static final variables referring
26   * to the JavaType representation for JDO supported map types.
27   * 
28   * @see PredefinedType#collectionType
29   * @see PredefinedType#setType
30   * @see PredefinedType#listType
31   * @see PredefinedType#hashSetType 
32   * @see PredefinedType#treeSetType
33   * @see PredefinedType#arrayListType
34   * @see PredefinedType#linkedListType
35   * @see PredefinedType#vectorType
36   * @see PredefinedType#stackType
37   *
38   * @author Michael Bouschen
39   * @since JDO 1.0.1
40   */
41  public class JDOSupportedCollectionType
42      extends PredefinedType
43  {
44      /*** 
45       * Constructor for JDOSupportedCollection types having no superclass. 
46       * These are the collection interfaces among the JDO supported 
47       * collection types. 
48       * @param clazz the Class instance representing the type.
49       */
50      public JDOSupportedCollectionType(Class clazz)
51      {
52          super(clazz);
53      }
54  
55      /*** 
56       * Constructor for JDOSupportedCollection types having a superclass. 
57       * These are the collection implemenatation classes among the JDO 
58       * supported collection types. 
59       * @param clazz the Class instance representing the type
60       * @param superclass JavaType instance representing the superclass.
61       */
62      public JDOSupportedCollectionType(Class clazz, JavaType superclass)
63      {
64          super(clazz, superclass);
65      }
66  
67      /*** 
68       * Returns <code>true</code> if this JavaType represents a JDO
69       * supported collection type. The JDO specification allows the
70       * following collection interfaces and classes as types of persistent 
71       * fields (see section 6.4.3 Persistent fields):
72       * @return <code>true</code> if this JavaType represents a JDO
73       * supported collection; <code>false</code> otherwise.
74       */
75      public boolean isJDOSupportedCollection() 
76      {
77          return true;
78      }
79  
80      /***
81       * Returns <code>true</code> if this JavaType represents a trackable
82       * Java class. A JDO implementation may replace a persistent field of
83       * a trackable type with an assignment compatible instance of its own
84       * implementation of this type which notifies the owning FCO of any
85       * change of this field. 
86       * @return <code>true</code> if this JavaType represents a trackable
87       * Java class, <code>false</code> otherwise.
88       */
89      public boolean isTrackable()
90      {
91          return true;
92      }
93      
94  }