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