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.model.jdo;
18  
19  import org.apache.jdo.model.ModelException;
20  import org.apache.jdo.model.java.JavaType;
21  
22  
23  /***
24   * A JDOCollection instance represents the JDO relationship metadata 
25   * of a collection relationship field. 
26   *
27   * @author Michael Bouschen
28   */
29  public interface JDOCollection
30      extends JDORelationship 
31  {
32      /***
33       * Determines whether the values of the elements should be stored if 
34       * possible as part of the instance instead of as their own instances 
35       * in the datastore.
36       * @return <code>true</code> if the elements should be stored as part of 
37       * the instance; <code>false</code> otherwise
38       */
39      public boolean isEmbeddedElement();
40      
41      /***
42       * Set whether the values of the elements should be stored if possible as 
43       * part of the instance instead of as their own instances in the datastore.
44       * @param embeddedElement <code>true</code> if elements should be stored 
45       * as part of the instance
46       * @exception ModelException if impossible
47       */
48      public void setEmbeddedElement(boolean embeddedElement)
49          throws ModelException;
50  
51      /*** 
52       * Get the type representation of the collection elements. 
53       * @return the element type
54       */
55      public JavaType getElementType();
56  
57      /*** 
58       * Set the type representation of the collection elements.
59       * @param elementType the type representation of the collection elements
60       * @exception ModelException if impossible
61       */
62      public void setElementType(JavaType elementType)
63          throws ModelException;
64  
65      /*** 
66       * Get the type of collection elements as string.
67       * @return the element type as string
68       */
69      public String getElementTypeName();
70  
71      /*** 
72       * Set string representation of the type of collection elements.
73       * @param elementTypeName a string representation of the type of elements in
74       * the collection. 
75       * @exception ModelException if impossible
76       */
77      public void setElementTypeName(String elementTypeName)
78          throws ModelException;
79  
80  }