Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.impl.model.jdo.caching » [javadoc | source]
    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.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       // ===== Methods specified in JDOField =====
   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   }

Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.impl.model.jdo.caching » [javadoc | source]