1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.expando.model;
16  
17  /**
18   * <a href="ExpandoColumnConstants.java.html"><b><i>View Source</i></b></a>
19   *
20   * @author Raymond Augé
21   */
22  public class ExpandoColumnConstants {
23  
24      public static final int BOOLEAN = 1;
25  
26      public static final String BOOLEAN_LABEL = "boolean";
27  
28      public static final int BOOLEAN_ARRAY = 2;
29  
30      public static final String BOOLEAN_ARRAY_LABEL = "boolean[]";
31  
32      public static final int DATE = 3;
33  
34      public static final String DATE_LABEL = "java.util.Date";
35  
36      public static final int DATE_ARRAY = 4;
37  
38      public static final String DATE_ARRAY_LABEL = "java.util.Date[]";
39  
40      public static final int DOUBLE = 5;
41  
42      public static final String DOUBLE_LABEL = "double";
43  
44      public static final int DOUBLE_ARRAY = 6;
45  
46      public static final String DOUBLE_ARRAY_LABEL = "double[]";
47  
48      public static final int FLOAT = 7;
49  
50      public static final String FLOAT_LABEL = "float";
51  
52      public static final int FLOAT_ARRAY = 8;
53  
54      public static final String FLOAT_ARRAY_LABEL = "float[]";
55  
56      public static final int INTEGER = 9;
57  
58      public static final String INTEGER_LABEL = "int";
59  
60      public static final int INTEGER_ARRAY = 10;
61  
62      public static final String INTEGER_ARRAY_LABEL = "int[]";
63  
64      public static final int LONG = 11;
65  
66      public static final String LONG_LABEL = "long";
67  
68      public static final int LONG_ARRAY = 12;
69  
70      public static final String LONG_ARRAY_LABEL = "long[]";
71  
72      public static final int SHORT = 13;
73  
74      public static final String SHORT_LABEL = "short";
75  
76      public static final int SHORT_ARRAY = 14;
77  
78      public static final String SHORT_ARRAY_LABEL = "short[]";
79  
80      public static final int STRING = 15;
81  
82      public static final String STRING_LABEL = "java.lang.String";
83  
84      public static final int STRING_ARRAY = 16;
85  
86      public static final String STRING_ARRAY_LABEL = "java.lang.String[]";
87  
88      public static final String UNKNOWN_LABEL = "Unknown";
89  
90      public static final int[] TYPES = new int[] {
91          BOOLEAN, BOOLEAN_ARRAY, DATE, DATE_ARRAY, DOUBLE, DOUBLE_ARRAY, FLOAT,
92          FLOAT_ARRAY, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT,
93          SHORT_ARRAY, STRING, STRING_ARRAY
94      };
95  
96      public static final String getTypeLabel(int type) {
97          if (type == BOOLEAN) {
98              return BOOLEAN_LABEL;
99          }
100         else if (type == BOOLEAN_ARRAY) {
101             return BOOLEAN_ARRAY_LABEL;
102         }
103         else if (type == DATE) {
104             return DATE_LABEL;
105         }
106         else if (type == DATE_ARRAY) {
107             return DATE_ARRAY_LABEL;
108         }
109         else if (type == DOUBLE) {
110             return DOUBLE_LABEL;
111         }
112         else if (type == DOUBLE_ARRAY) {
113             return DOUBLE_ARRAY_LABEL;
114         }
115         else if (type == FLOAT) {
116             return FLOAT_LABEL;
117         }
118         else if (type == FLOAT_ARRAY) {
119             return FLOAT_ARRAY_LABEL;
120         }
121         else if (type == INTEGER) {
122             return INTEGER_LABEL;
123         }
124         else if (type == INTEGER_ARRAY) {
125             return INTEGER_ARRAY_LABEL;
126         }
127         else if (type == LONG) {
128             return LONG_LABEL;
129         }
130         else if (type == LONG_ARRAY) {
131             return LONG_ARRAY_LABEL;
132         }
133         else if (type == SHORT) {
134             return SHORT_LABEL;
135         }
136         else if (type == SHORT_ARRAY) {
137             return SHORT_ARRAY_LABEL;
138         }
139         else if (type == STRING) {
140             return STRING_LABEL;
141         }
142         else if (type == STRING_ARRAY) {
143             return STRING_ARRAY_LABEL;
144         }
145 
146         return UNKNOWN_LABEL;
147     }
148 
149 }