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