001: package org.apache.torque.map;
002:
003: /*
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021:
022: /**
023: * InheritanceMap is used to model OM inheritance classes.
024: *
025: * @author <a href="mailto:greg.monroe@dukece.com">Greg Monroe</a>
026: * @version $Id$
027: */
028: public class InheritanceMap {
029: /**
030: * The value in the related column that is associated with
031: * this information.
032: */
033: private String key;
034:
035: /**
036: * The name of the class which impliments this inheritance mode.
037: */
038: private String className;
039:
040: /**
041: * The name of class which class name extends.
042: * Retrieved via getExtends().
043: */
044: private String ancestor;
045:
046: /** The column this info is related to. */
047: private ColumnMap column;
048:
049: /**
050: * Create an inheritance map object.
051: *
052: * @param column The column this inheritance map belongs to.
053: * @param key Key to determine which subclass applies
054: * @param className package.Name of sub class to use for record.
055: * @param ancestor package.Name of class that className extends.
056: */
057: public InheritanceMap(ColumnMap column, String key,
058: String className, String ancestor) {
059: setColumn(column);
060: setKey(key);
061: setClassName(className);
062: setExtends(ancestor);
063: }
064:
065: /**
066: * Returns the ancestor class for the class described by this
067: * InheritanceMap.
068: *
069: * @return the ancestor class for the class described by this
070: * InheritanceMap.
071: */
072: public String getExtends() {
073: return ancestor;
074: }
075:
076: /**
077: * Sets the ancestor class for the class described by this InheritanceMap.
078: *
079: * @param ancestor The ancestor for the class described by this
080: * InheritanceMap.
081: */
082: public void setExtends(String ancestor) {
083: this .ancestor = ancestor;
084: }
085:
086: /**
087: * Returns the class name for this InheritanceMap.
088: *
089: * @return The class name for this InheritanceMap.
090: */
091: public String getClassName() {
092: return className;
093: }
094:
095: /**
096: * Sets the class name for this InheritanceMap.
097: *
098: * @param className The className for this InheritanceMap.
099: */
100: public void setClassName(String className) {
101: this .className = className;
102: }
103:
104: /**
105: * Returns the column this inheritance map belongs to.
106: *
107: * @return the column this inheritance map belongs to.
108: */
109: public ColumnMap getColumn() {
110: return column;
111: }
112:
113: /**
114: * Sets the column this inheritance map belongs to.
115: *
116: * @param column the column this inheritance map belongs to.
117: */
118: public void setColumn(ColumnMap column) {
119: this .column = column;
120: }
121:
122: /**
123: * Returns the key by which this inheritanceMap is activated.
124: *
125: * @return The key by which this inheritanceMap is activated.
126: */
127: public String getKey() {
128: return key;
129: }
130:
131: /**
132: * Sets the key by which this inheritanceMap is activated.
133: *
134: * @param key The key by which this inheritanceMap is activated.
135: */
136: public void setKey(String key) {
137: this.key = key;
138: }
139: }
|