|
63 | 63 | */ |
64 | 64 | public final class ModelerUtil { |
65 | 65 |
|
| 66 | + static final String[] REGISTERED_TYPE_NAMES; |
| 67 | + static { |
| 68 | + String[] nonPrimitivesNames = { |
| 69 | + String.class.getName(), |
| 70 | + BigDecimal.class.getName(), |
| 71 | + BigInteger.class.getName(), |
| 72 | + Boolean.class.getName(), |
| 73 | + Byte.class.getName(), |
| 74 | + Character.class.getName(), |
| 75 | + Date.class.getName(), |
| 76 | + java.util.Date.class.getName(), |
| 77 | + Double.class.getName(), |
| 78 | + Float.class.getName(), |
| 79 | + Integer.class.getName(), |
| 80 | + Long.class.getName(), |
| 81 | + Short.class.getName(), |
| 82 | + Time.class.getName(), |
| 83 | + Timestamp.class.getName(), |
| 84 | + GregorianCalendar.class.getName(), |
| 85 | + Calendar.class.getName(), |
| 86 | + UUID.class.getName(), |
| 87 | + Serializable.class.getName(), |
| 88 | + Json.class.getName(), |
| 89 | + Wkt.class.getName(), |
| 90 | + GeoJson.class.getName(), |
| 91 | + "java.lang.Character[]", |
| 92 | + "java.lang.Byte[]", |
| 93 | + "java.time.LocalDate", |
| 94 | + "java.time.LocalTime", |
| 95 | + "java.time.LocalDateTime", |
| 96 | + "java.time.Duration", |
| 97 | + "java.time.Period" |
| 98 | + }; |
| 99 | + Arrays.sort(nonPrimitivesNames); |
| 100 | + |
| 101 | + String[] primitivesNames = { |
| 102 | + "boolean", "byte", "byte[]", "char", "char[]", "double", "float", "int", "long", "short" |
| 103 | + }; |
| 104 | + |
| 105 | + REGISTERED_TYPE_NAMES = new String[primitivesNames.length + nonPrimitivesNames.length + 1]; |
| 106 | + |
| 107 | + REGISTERED_TYPE_NAMES[0] = ""; |
| 108 | + System.arraycopy(primitivesNames, 0, REGISTERED_TYPE_NAMES, 1, primitivesNames.length); |
| 109 | + System.arraycopy( |
| 110 | + nonPrimitivesNames, |
| 111 | + 0, |
| 112 | + REGISTERED_TYPE_NAMES, |
| 113 | + primitivesNames.length + 1, |
| 114 | + nonPrimitivesNames.length); |
| 115 | + } |
| 116 | + |
66 | 117 | /** |
67 | 118 | * Returns the "name" property of the object. |
68 | 119 | * |
@@ -109,55 +160,7 @@ public static Collection<String> getDbAttributeNames(DbEntity entity) { |
109 | 160 | } |
110 | 161 |
|
111 | 162 | public static String[] getRegisteredTypeNames() { |
112 | | - String[] nonPrimitivesNames = { |
113 | | - String.class.getName(), |
114 | | - BigDecimal.class.getName(), |
115 | | - BigInteger.class.getName(), |
116 | | - Boolean.class.getName(), |
117 | | - Byte.class.getName(), |
118 | | - Character.class.getName(), |
119 | | - Date.class.getName(), |
120 | | - java.util.Date.class.getName(), |
121 | | - Double.class.getName(), |
122 | | - Float.class.getName(), |
123 | | - Integer.class.getName(), |
124 | | - Long.class.getName(), |
125 | | - Short.class.getName(), |
126 | | - Time.class.getName(), |
127 | | - Timestamp.class.getName(), |
128 | | - GregorianCalendar.class.getName(), |
129 | | - Calendar.class.getName(), |
130 | | - UUID.class.getName(), |
131 | | - Serializable.class.getName(), |
132 | | - Json.class.getName(), |
133 | | - Wkt.class.getName(), |
134 | | - GeoJson.class.getName(), |
135 | | - "java.lang.Character[]", |
136 | | - "java.lang.Byte[]", |
137 | | - "java.time.LocalDate", |
138 | | - "java.time.LocalTime", |
139 | | - "java.time.LocalDateTime", |
140 | | - "java.time.Duration", |
141 | | - "java.time.Period" |
142 | | - }; |
143 | | - Arrays.sort(nonPrimitivesNames); |
144 | | - |
145 | | - String[] primitivesNames = { |
146 | | - "boolean", "byte", "byte[]", "char", "char[]", "double", "float", "int", "long", "short" |
147 | | - }; |
148 | | - |
149 | | - String[] finalList = new String[primitivesNames.length + nonPrimitivesNames.length + 1]; |
150 | | - |
151 | | - finalList[0] = ""; |
152 | | - System.arraycopy(primitivesNames, 0, finalList, 1, primitivesNames.length); |
153 | | - System.arraycopy( |
154 | | - nonPrimitivesNames, |
155 | | - 0, |
156 | | - finalList, |
157 | | - primitivesNames.length + 1, |
158 | | - nonPrimitivesNames.length); |
159 | | - |
160 | | - return finalList; |
| 163 | + return REGISTERED_TYPE_NAMES; |
161 | 164 | } |
162 | 165 |
|
163 | 166 | public static DataNodeDescriptor getNodeLinkedToMap(DataChannelDescriptor domain, DataMap map) { |
|
0 commit comments