001: package org.apache.torque.om;
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: * This empty class marks an ObjectKey as being capable of being
024: * represented as a single column in a database.
025: *
026: * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
027: * @author <a href="mailto:drfish@cox.net">J. Russell Smyth</a>
028: * @version $Id: SimpleKey.java 473821 2006-11-11 22:37:25Z tv $
029: */
030: public abstract class SimpleKey extends ObjectKey {
031: /**
032: * Creates a SimpleKey equivalent to key
033: * @param key the key value
034: * @return a SimpleKey
035: */
036: public static SimpleKey keyFor(java.math.BigDecimal key) {
037: return new NumberKey(key);
038: }
039:
040: /**
041: * Creates a SimpleKey equivalent to key
042: * @param key the key value
043: * @return a SimpleKey
044: */
045: public static SimpleKey keyFor(int key) {
046: return new NumberKey(key);
047: }
048:
049: /**
050: * Creates a SimpleKey equivalent to key
051: * @param key the key value
052: * @return a SimpleKey
053: */
054: public static SimpleKey keyFor(long key) {
055: return new NumberKey(key);
056: }
057:
058: /**
059: * Creates a SimpleKey equivalent to key
060: * @param key the key value
061: * @return a SimpleKey
062: */
063: public static SimpleKey keyFor(double key) {
064: return new NumberKey(key);
065: }
066:
067: /**
068: * Creates a SimpleKey equivalent to key
069: * @param key the key value
070: * @return a SimpleKey
071: */
072: public static SimpleKey keyFor(Number key) {
073: return new NumberKey(key);
074: }
075:
076: /**
077: * Creates a SimpleKey equivalent to key
078: * @param key the key value
079: * @return a SimpleKey
080: */
081: public static SimpleKey keyFor(NumberKey key) {
082: return new NumberKey(key);
083: }
084:
085: /**
086: * Creates a SimpleKey equivalent to key
087: * @param key the key value
088: * @return a SimpleKey
089: */
090: public static SimpleKey keyFor(String key) {
091: return new StringKey(key);
092: }
093:
094: /**
095: * Creates a SimpleKey equivalent to key
096: * @param key the key value
097: * @return a SimpleKey
098: */
099: public static SimpleKey keyFor(StringKey key) {
100: return new StringKey(key);
101: }
102:
103: /**
104: * Creates a SimpleKey equivalent to key
105: * @param key the key value
106: * @return a SimpleKey
107: */
108: public static SimpleKey keyFor(java.util.Date key) {
109: return new DateKey(key);
110: }
111:
112: /**
113: * Creates a SimpleKey equivalent to key
114: * @param key the key value
115: * @return a SimpleKey
116: */
117: public static SimpleKey keyFor(DateKey key) {
118: return new DateKey(key);
119: }
120: }
|