1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jdo.impl.model.jdo.caching;
18
19 import org.apache.jdo.model.jdo.JDORelationship;
20 import org.apache.jdo.impl.model.jdo.JDOReferenceImplDynamic;
21
22 /***
23 * An instance of this class represents the JDO relationship metadata
24 * of a reference relationship field. This caching implementation
25 * caches any calulated value to avoid re-calculating it if it is
26 * requested again.
27 *
28 * @author Michael Bouschen
29 * @since 2.0
30 * @version 2.0
31 */
32 public class JDOReferenceImplCaching extends JDOReferenceImplDynamic {
33
34 /***
35 * Get the mappedBy relationship. If there is no mappedBy relationship
36 * set, the method checks the mappedBy name as specified in the declaring
37 * field and resolves the relationship. The method returns
38 * <code>null</code> if there is no mappedBy relationship set and there
39 * is no mappedBy name specified on the declaring field.
40 * @return the mappedBy relationship if available; <code>null</code>
41 * otherwise.
42 */
43 public JDORelationship getMappedBy() {
44 if (mappedBy == null) {
45 mappedBy = super.getMappedBy();
46 }
47 return mappedBy;
48 }
49
50 /***
51 * Get the inverse JDORelationship in the case of a two-way relationship.
52 * @return the inverse relationship
53 */
54 public JDORelationship getInverseRelationship() {
55 if (inverse == null) {
56 inverse = super.getInverseRelationship();
57 }
58 return inverse;
59 }
60 }