View Javadoc

1   package org.apache.torque.om;
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   * This empty class  marks an ObjectKey as being capable of being
24   * represented as a single column in a database.
25   *
26   * @author <a href="mailto:jmcnally@apache.org">John McNally</a>
27   * @author <a href="mailto:drfish@cox.net">J. Russell Smyth</a>
28   * @version $Id: SimpleKey.java 473821 2006-11-11 22:37:25Z tv $
29   */
30  public abstract class SimpleKey extends ObjectKey
31  {
32      /***
33       * Creates a SimpleKey equivalent to key
34       * @param key the key value
35       * @return a SimpleKey
36       */
37      public static SimpleKey keyFor(java.math.BigDecimal key)
38      {
39          return new NumberKey(key);
40      }
41  
42      /***
43       * Creates a SimpleKey equivalent to key
44       * @param key the key value
45       * @return a SimpleKey
46       */
47      public static SimpleKey keyFor(int key)
48      {
49          return new NumberKey(key);
50      }
51  
52      /***
53       * Creates a SimpleKey equivalent to key
54       * @param key the key value
55       * @return a SimpleKey
56       */
57      public static SimpleKey keyFor(long key)
58      {
59          return new NumberKey(key);
60      }
61  
62      /***
63       * Creates a SimpleKey equivalent to key
64       * @param key the key value
65       * @return a SimpleKey
66       */
67      public static SimpleKey keyFor(double key)
68      {
69          return new NumberKey(key);
70      }
71  
72      /***
73       * Creates a SimpleKey equivalent to key
74       * @param key the key value
75       * @return a SimpleKey
76       */
77      public static SimpleKey keyFor(Number key)
78      {
79          return new NumberKey(key);
80      }
81  
82      /***
83       * Creates a SimpleKey equivalent to key
84       * @param key the key value
85       * @return a SimpleKey
86       */
87      public static SimpleKey keyFor(NumberKey key)
88      {
89          return new NumberKey(key);
90      }
91  
92      /***
93       * Creates a SimpleKey equivalent to key
94       * @param key the key value
95       * @return a SimpleKey
96       */
97      public static SimpleKey keyFor(String key)
98      {
99          return new StringKey(key);
100     }
101 
102     /***
103      * Creates a SimpleKey equivalent to key
104      * @param key the key value
105      * @return a SimpleKey
106      */
107     public static SimpleKey keyFor(StringKey key)
108     {
109         return new StringKey(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(java.util.Date key)
118     {
119         return new DateKey(key);
120     }
121 
122     /***
123      * Creates a SimpleKey equivalent to key
124      * @param key the key value
125      * @return a SimpleKey
126      */
127     public static SimpleKey keyFor(DateKey key)
128     {
129         return new DateKey(key);
130     }
131 }