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 JDOMap instance represents the JDO relationship metadata 
25   * (the treatment of keys and values) of a map relationship field. 
26   *
27   * @author Michael Bouschen
28   */
29  public interface JDOMap
30      extends JDORelationship 
31  {
32      /***
33       * Determines whether the keys of the map should be stored if possible as 
34       * part of the instance instead of as their own instances in the datastore.
35       * @return <code>true</code> if the keys are stored as part of this instance;
36       * <code>false</code> otherwise
37       */
38      public boolean isEmbeddedKey();
39      
40      /***
41       * Set whether the keys of the map should be stored if possible as part 
42       * of the instance instead of as their own instances in the datastore.
43       * @param embeddedKey <code>true</code> if the keys are stored as part of
44       * this instance; <code>false</code> otherwise
45       * @exception ModelException if impossible
46       */
47      public void setEmbeddedKey(boolean embeddedKey)
48          throws ModelException;
49  
50      /***
51       * Get the type representation of the keys for this JDOMap.
52       * @return the type of the keys of this JDOMap  
53       */
54      public JavaType getKeyType();
55  
56      /***
57       * Set the type representation of the keys for this JDOMap.
58       * @param keyType the type representation of the keys
59       * @exception ModelException if impossible
60       */
61      public void setKeyType(JavaType keyType)
62          throws ModelException;
63  
64      /***
65       * Get the string representation of the type of the keys for this JDOMap.
66       * @return the key type as string
67       */
68      public String getKeyTypeName();
69  
70      /***
71       * Set string representation of the type of the keys for this JDOMap.
72       * @param keyTypeName the name of the key type
73       * @exception ModelException if impossible
74       */
75      public void setKeyTypeName(String keyTypeName)
76          throws ModelException;
77  
78      /***
79       * Determines whether the values of the map should be stored if possible as 
80       * part of the instance instead of as their own instances in the datastore.
81       * @return <code>true</code> if the values are stored as part of this 
82       * instance; <code>false</code> otherwise
83       */
84      public boolean isEmbeddedValue();
85      
86      /***
87       * Set whether the values of the map should be stored if possible as part 
88       * of the instance instead of as their own instances in the datastore.
89       * @param embeddedValue <code>true</code> if the values are stored as part 
90       * of this instance; <code>false</code> otherwise
91       * @exception ModelException if impossible
92       */
93      public void setEmbeddedValue(boolean embeddedValue)
94          throws ModelException;
95  
96      /***
97       * Get the type representation of the values for this JDOMap.
98       * @return the type of the values of this JDOMap  
99       */
100     public JavaType getValueType();
101 
102     /***
103      * Set the type representation of the values for this JDOMap.
104      * @param valueType the type representation of the values
105      * @exception ModelException if impossible
106      */
107     public void setValueType(JavaType valueType)
108         throws ModelException;
109 
110     /***
111      * Get the string representation of the type of the values for this JDOMap.
112      * @return the key value as string
113      */
114     public String getValueTypeName();
115 
116     /***
117      * Set string representation of the type of the values for this JDOMap.
118      * @param valueTypeName the name of the value type
119      * @exception ModelException if impossible
120      */
121     public void setValueTypeName(String valueTypeName)
122         throws ModelException;
123 
124 }