1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.dao.orm.hibernate;
16  
17  import com.liferay.portal.kernel.dao.orm.Type;
18  
19  /**
20   * <a href="TypeTranslator.java.html"><b><i>View Source</i></b></a>
21   *
22   * @author Brian Wing Shun Chan
23   */
24  public class TypeTranslator {
25  
26      public static org.hibernate.type.Type translate(Type type) {
27          if (type == Type.BIG_DECIMAL) {
28              return org.hibernate.Hibernate.BIG_DECIMAL;
29          }
30          else if (type == Type.BIG_INTEGER) {
31              return org.hibernate.Hibernate.BIG_INTEGER;
32          }
33          else if (type == Type.BINARY) {
34              return org.hibernate.Hibernate.BINARY;
35          }
36          else if (type == Type.BLOB) {
37              return org.hibernate.Hibernate.BLOB;
38          }
39          else if (type == Type.BOOLEAN) {
40              return org.hibernate.Hibernate.BOOLEAN;
41          }
42          else if (type == Type.BYTE) {
43              return org.hibernate.Hibernate.BYTE;
44          }
45          else if (type == Type.CALENDAR) {
46              return org.hibernate.Hibernate.CALENDAR;
47          }
48          else if (type == Type.CALENDAR_DATE) {
49              return org.hibernate.Hibernate.CALENDAR_DATE;
50          }
51          else if (type == Type.CHAR_ARRAY) {
52              return org.hibernate.Hibernate.CHAR_ARRAY;
53          }
54          else if (type == Type.CHARACTER) {
55              return org.hibernate.Hibernate.CHARACTER;
56          }
57          else if (type == Type.CHARACTER_ARRAY) {
58              return org.hibernate.Hibernate.CHARACTER_ARRAY;
59          }
60          else if (type == Type.CLASS) {
61              return org.hibernate.Hibernate.CLASS;
62          }
63          else if (type == Type.CLOB) {
64              return org.hibernate.Hibernate.CLOB;
65          }
66          else if (type == Type.CURRENCY) {
67              return org.hibernate.Hibernate.CURRENCY;
68          }
69          else if (type == Type.DATE) {
70              return org.hibernate.Hibernate.DATE;
71          }
72          else if (type == Type.DOUBLE) {
73              return org.hibernate.Hibernate.DOUBLE;
74          }
75          else if (type == Type.FLOAT) {
76              return org.hibernate.Hibernate.FLOAT;
77          }
78          else if (type == Type.INTEGER) {
79              return org.hibernate.Hibernate.INTEGER;
80          }
81          else if (type == Type.LOCALE) {
82              return org.hibernate.Hibernate.LOCALE;
83          }
84          else if (type == Type.LONG) {
85              return org.hibernate.Hibernate.LONG;
86          }
87          else if (type == Type.OBJECT) {
88              return org.hibernate.Hibernate.OBJECT;
89          }
90          else if (type == Type.SERIALIZABLE) {
91              return org.hibernate.Hibernate.SERIALIZABLE;
92          }
93          else if (type == Type.SHORT) {
94              return org.hibernate.Hibernate.SHORT;
95          }
96          else if (type == Type.STRING) {
97              return org.hibernate.Hibernate.STRING;
98          }
99          else if (type == Type.TEXT) {
100             return org.hibernate.Hibernate.TEXT;
101         }
102         else if (type == Type.TIMESTAMP) {
103             return org.hibernate.Hibernate.TIMESTAMP;
104         }
105         else if (type == Type.TIMEZONE) {
106             return org.hibernate.Hibernate.TIMEZONE;
107         }
108         else if (type == Type.TRUE_FALSE) {
109             return org.hibernate.Hibernate.TRUE_FALSE;
110         }
111         else if (type == Type.WRAPPER_BINARY) {
112             return org.hibernate.Hibernate.WRAPPER_BINARY;
113         }
114         else if (type == Type.YES_NO) {
115             return org.hibernate.Hibernate.YES_NO;
116         }
117         else {
118             return null;
119         }
120     }
121 
122 }