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.impl.model.jdo;
18  
19  import org.apache.jdo.model.java.JavaType;
20  import org.apache.jdo.model.jdo.JDOReference;
21  
22  /***
23   * An instance of this class represents the JDO relationship metadata 
24   * of a reference relationship field.
25   *
26   * @author Michael Bouschen
27   */
28  public class JDOReferenceImplDynamic extends JDORelationshipImpl 
29      implements JDOReference
30  {
31  
32      /***
33       * Determines whether this JDORelationship represents a reference
34       * relationship or not. A return of <code>true</code> means this
35       * JDORelationship is a JDOReference instance.
36       * @return <code>true</code> if this JDORelationship represents a
37       * reference relationship; <code>false</code> otherwise.
38       */
39      public boolean isJDOReference() {
40          return true;
41      }
42  
43      //========= Internal helper methods ==========
44  
45      /*** 
46       * Get the type representation of the relationship. This will be 
47       * the JavaType for references, the element type for collections
48       * and arrays, and the value type for maps.
49       * @return the relationship type
50       */
51      public JavaType getRelatedJavaType() {
52          return getDeclaringField().getType();
53      }
54  
55  }