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 1206841 2011-11-27 20:46:17Z tfischer $
29   */
30  public abstract class SimpleKey extends ObjectKey
31  {
32      /** Version id for serializing. */
33      private static final long serialVersionUID = 1L;
34  
35      /**
36       * Creates an ObjectKey for the key object.
37       *
38       * @param key the key value.
39       *
40       * @return an ObjectKey for <code>key</code>.
41       */
42      public static NumberKey keyFor(java.math.BigDecimal key)
43      {
44          return new NumberKey(key);
45      }
46  
47      /**
48       * Creates an ObjectKey for the key object.
49       *
50       * @param key the key value.
51       *
52       * @return an ObjectKey for <code>key</code>.
53       */
54      public static NumberKey keyFor(int key)
55      {
56          return new NumberKey(key);
57      }
58  
59      /**
60       * Creates an ObjectKey for the key object.
61       *
62       * @param key the key value.
63       *
64       * @return an ObjectKey for <code>key</code>.
65       */
66      public static NumberKey keyFor(long key)
67      {
68          return new NumberKey(key);
69      }
70  
71      /**
72       * Creates an ObjectKey for the key object.
73       *
74       * @param key the key value.
75       *
76       * @return an ObjectKey for <code>key</code>.
77       */
78      public static NumberKey keyFor(double key)
79      {
80          return new NumberKey(key);
81      }
82  
83      /**
84       * Creates an ObjectKey for the key object.
85       *
86       * @param key the key value.
87       *
88       * @return an ObjectKey for <code>key</code>.
89       */
90      public static NumberKey keyFor(Number key)
91      {
92          return new NumberKey(key);
93      }
94  
95      /**
96       * Creates an ObjectKey for the key object.
97       *
98       * @param key the key value.
99       *
100      * @return an ObjectKey for <code>key</code>.
101      */
102     public static NumberKey keyFor(NumberKey key)
103     {
104         return new NumberKey(key);
105     }
106 
107     /**
108      * Creates an ObjectKey for the key object.
109      *
110      * @param key the key value.
111      *
112      * @return an ObjectKey for <code>key</code>.
113      */
114     public static StringKey keyFor(String key)
115     {
116         return new StringKey(key);
117     }
118 
119     /**
120      * Creates an ObjectKey for the key object.
121      *
122      * @param key the key value.
123      *
124      * @return an ObjectKey for <code>key</code>.
125      */
126     public static StringKey keyFor(StringKey key)
127     {
128         return new StringKey(key);
129     }
130 
131     /**
132      * Creates an ObjectKey for the key object.
133      *
134      * @param key the key value.
135      *
136      * @return an ObjectKey for <code>key</code>.
137      */
138     public static DateKey keyFor(java.util.Date key)
139     {
140         return new DateKey(key);
141     }
142 
143     /**
144      * Creates an ObjectKey for the key object.
145      *
146      * @param key the key value.
147      *
148      * @return an ObjectKey for <code>key</code>.
149      */
150     public static DateKey keyFor(DateKey key)
151     {
152         return new DateKey(key);
153     }
154 
155     /**
156      * Creates an ObjectKey for the key object.
157      *
158      * @param key the key value.
159      *
160      * @return an ObjectKey for <code>key</code>.
161      */
162     public static BooleanKey keyFor(Boolean key)
163     {
164         return new BooleanKey(key);
165     }
166 }