View Javadoc

1   package org.apache.torque.om;
2   
3   /*
4    * Copyright 2001-2005 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License")
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  /***
20   * This empty class  marks an ObjectKey as being capable of being
21   * represented as a single column in a database.
22   *
23   * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
24   * @author <a href="mailto:drfish@cox.net">J. Russell Smyth</a>
25   * @version $Id: SimpleKey.java 239636 2005-08-24 12:38:09Z henning $
26   */
27  public abstract class SimpleKey extends ObjectKey
28  {
29      /***
30       * Creates a SimpleKey equivalent to key
31       * @param key the key value
32       * @return a SimpleKey
33       */
34      public static SimpleKey keyFor(java.math.BigDecimal key)
35      {
36          return new NumberKey(key);
37      }
38  
39      /***
40       * Creates a SimpleKey equivalent to key
41       * @param key the key value
42       * @return a SimpleKey
43       */
44      public static SimpleKey keyFor(int key)
45      {
46          return new NumberKey(key);
47      }
48  
49      /***
50       * Creates a SimpleKey equivalent to key
51       * @param key the key value
52       * @return a SimpleKey
53       */
54      public static SimpleKey keyFor(long key)
55      {
56          return new NumberKey(key);
57      }
58  
59      /***
60       * Creates a SimpleKey equivalent to key
61       * @param key the key value
62       * @return a SimpleKey
63       */
64      public static SimpleKey keyFor(double key)
65      {
66          return new NumberKey(key);
67      }
68  
69      /***
70       * Creates a SimpleKey equivalent to key
71       * @param key the key value
72       * @return a SimpleKey
73       */
74      public static SimpleKey keyFor(Number key)
75      {
76          return new NumberKey(key);
77      }
78  
79      /***
80       * Creates a SimpleKey equivalent to key
81       * @param key the key value
82       * @return a SimpleKey
83       */
84      public static SimpleKey keyFor(NumberKey key)
85      {
86          return new NumberKey(key);
87      }
88  
89      /***
90       * Creates a SimpleKey equivalent to key
91       * @param key the key value
92       * @return a SimpleKey
93       */
94      public static SimpleKey keyFor(String key)
95      {
96          return new StringKey(key);
97      }
98  
99      /***
100      * Creates a SimpleKey equivalent to key
101      * @param key the key value
102      * @return a SimpleKey
103      */
104     public static SimpleKey keyFor(StringKey key)
105     {
106         return new StringKey(key);
107     }
108 
109     /***
110      * Creates a SimpleKey equivalent to key
111      * @param key the key value
112      * @return a SimpleKey
113      */
114     public static SimpleKey keyFor(java.util.Date key)
115     {
116         return new DateKey(key);
117     }
118 
119     /***
120      * Creates a SimpleKey equivalent to key
121      * @param key the key value
122      * @return a SimpleKey
123      */
124     public static SimpleKey keyFor(DateKey key)
125     {
126         return new DateKey(key);
127     }
128 }