1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jdo.impl.model.jdo.caching;
19
20 import org.apache.jdo.model.ModelException;
21 import org.apache.jdo.model.java.JavaField;
22 import org.apache.jdo.model.java.JavaProperty;
23 import org.apache.jdo.model.jdo.JDOClass;
24 import org.apache.jdo.model.jdo.JDOField;
25 import org.apache.jdo.impl.model.jdo.JDOAssociatedPropertyImplDynamic;
26
27 /***
28 * An instance of this class represents the JDO metadata of a managed property
29 * of a persistence capable class. This JDOProperty implementation is used for
30 * persistent properties with an associated JDOField. All JDOField getter
31 * methods delegate to the associated JDOField, except methods getName,
32 * getDeclaringClass and getJavaField. All JDOField setter method throw a
33 * ModelException to avoid changing the associated JDOField through this
34 * JDOProperty instance. This caching implementation caches any calculated
35 * value to avoid re-calculating it if it is requested again.
36 *
37 * @author Michael Bouschen
38 * @since 2.0
39 * @version 2.0
40 */
41 public class JDOAssociatedPropertyImplCaching
42 extends JDOAssociatedPropertyImplDynamic
43 {
44 /*** Constructor. */
45 protected JDOAssociatedPropertyImplCaching(
46 String name, JDOClass declaringClass, JDOField associatedJDOField)
47 throws ModelException {
48 super(name, declaringClass, associatedJDOField);
49 }
50
51
52
53 /***
54 * Get the corresponding JavaProperty representation for this JDOProperty.
55 * @return the corresponding JavaProperty representation
56 */
57 public JavaField getJavaField() {
58 if (javaProperty == null) {
59 javaProperty = (JavaProperty)super.getJavaField();
60 }
61 return javaProperty;
62 }
63 }