View Javadoc

1   package org.apache.torque.map;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /***
23   * InheritanceMap is used to model OM inheritance classes.
24   *
25   * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
26   * @version $Id$
27   */
28  public class InheritanceMap
29  {
30      /***
31       * The value in the related column that is associated with
32       * this information.
33       */
34      private String key;
35  
36      /***
37       * The name of the class which impliments this inheritance mode.
38       */
39      private String className;
40  
41      /***
42       * The name of class which class name extends.
43       * Retrieved via getExtends().
44       */
45      private String ancestor;
46  
47      /*** The column this info is related to. */
48      private ColumnMap column;
49  
50      /***
51       * Create an inheritance map object.
52       *
53       * @param column The column this inheritance map belongs to.
54       * @param key Key to determine which subclass applies
55       * @param className package.Name of sub class to use for record.
56       * @param ancestor package.Name of class that className extends.
57       */
58      public InheritanceMap(ColumnMap column, String key, String className,
59              String ancestor)
60      {
61          setColumn(column);
62          setKey(key);
63          setClassName(className);
64          setExtends(ancestor);
65      }
66  
67      /***
68       * Returns the ancestor class for the class described by this
69       * InheritanceMap.
70       *
71       * @return the ancestor class for the class described by this
72       *         InheritanceMap.
73       */
74      public String getExtends()
75      {
76          return ancestor;
77      }
78  
79      /***
80       * Sets the ancestor class for the class described by this InheritanceMap.
81       *
82       * @param ancestor The ancestor for the class described by this
83       *        InheritanceMap.
84       */
85      public void setExtends(String ancestor)
86      {
87          this.ancestor = ancestor;
88      }
89  
90      /***
91       * Returns the class name for this InheritanceMap.
92       *
93       * @return The class name for this InheritanceMap.
94       */
95      public String getClassName()
96      {
97          return className;
98      }
99  
100     /***
101      * Sets the class name for this InheritanceMap.
102      *
103      * @param className The className for this InheritanceMap.
104      */
105     public void setClassName(String className)
106     {
107         this.className = className;
108     }
109 
110     /***
111      * Returns the column this inheritance map belongs to.
112      *
113      * @return the column this inheritance map belongs to.
114      */
115     public ColumnMap getColumn()
116     {
117         return column;
118     }
119 
120     /***
121      * Sets the column this inheritance map belongs to.
122      *
123      * @param column the column this inheritance map belongs to.
124      */
125     public void setColumn(ColumnMap column)
126     {
127         this.column = column;
128     }
129 
130     /***
131      * Returns the key by which this inheritanceMap is activated.
132      *
133      * @return The key by which this inheritanceMap is activated.
134      */
135     public String getKey()
136     {
137         return key;
138     }
139 
140     /***
141      * Sets the key by which this inheritanceMap is activated.
142      *
143      * @param key The key by which this inheritanceMap is activated.
144      */
145     public void setKey(String key)
146     {
147         this.key = key;
148     }
149 }