|
5 | 5 |
|
6 | 6 | import java.lang.reflect.InvocationTargetException;
|
7 | 7 | import java.lang.reflect.Method;
|
8 |
| -import java.math.BigDecimal; |
9 | 8 | import java.time.LocalDate;
|
10 | 9 | import java.time.ZonedDateTime;
|
11 | 10 | import java.util.ArrayList;
|
12 |
| -import java.util.Collections; |
13 | 11 | import java.util.HashSet;
|
14 | 12 | import java.util.LinkedHashMap;
|
15 | 13 | import java.util.LinkedHashSet;
|
@@ -41,21 +39,18 @@ private static Object castToAllowedTypes(Object arg, List<Object> pathToItem, Pa
|
41 | 39 | } else if (arg instanceof Boolean) {
|
42 | 40 | pathToType.put(pathToItem, Boolean.class);
|
43 | 41 | return arg;
|
44 |
| - } else if (arg instanceof BigDecimal) { |
45 |
| - pathToType.put(pathToItem, BigDecimal.class); |
46 |
| - return arg; |
47 | 42 | } else if (arg instanceof Integer) {
|
48 |
| - pathToType.put(pathToItem, BigDecimal.class); |
49 |
| - return BigDecimal.valueOf((Integer) arg); |
| 43 | + pathToType.put(pathToItem, Integer.class); |
| 44 | + return arg; |
50 | 45 | } else if (arg instanceof Long) {
|
51 |
| - pathToType.put(pathToItem, BigDecimal.class); |
52 |
| - return BigDecimal.valueOf((Long) arg); |
| 46 | + pathToType.put(pathToItem, Long.class); |
| 47 | + return arg; |
53 | 48 | } else if (arg instanceof Float) {
|
54 |
| - pathToType.put(pathToItem, BigDecimal.class); |
55 |
| - return BigDecimal.valueOf((Float) arg); |
| 49 | + pathToType.put(pathToItem, Float.class); |
| 50 | + return arg; |
56 | 51 | } else if (arg instanceof Double) {
|
57 |
| - pathToType.put(pathToItem, BigDecimal.class); |
58 |
| - return BigDecimal.valueOf((Double) arg); |
| 52 | + pathToType.put(pathToItem, Double.class); |
| 53 | + return arg; |
59 | 54 | } else if (arg instanceof List) {
|
60 | 55 | pathToType.put(pathToItem, List.class);
|
61 | 56 | List<Object> argFixed = new ArrayList<>();
|
@@ -174,28 +169,20 @@ static Boolean validate(Class<?> cls, Boolean arg, SchemaConfiguration configura
|
174 | 169 | return (Boolean) validateObject(cls, arg, configuration);
|
175 | 170 | }
|
176 | 171 |
|
177 |
| - static BigDecimal validate(Class<?> cls, BigDecimal arg, SchemaConfiguration configuration) { |
178 |
| - return (BigDecimal) validateObject(cls, arg, configuration); |
179 |
| - } |
180 |
| - |
181 | 172 | static Integer validate(Class<?> cls, Integer arg, SchemaConfiguration configuration) {
|
182 |
| - BigDecimal val = (BigDecimal) validateObject(cls, arg, configuration); |
183 |
| - return val.intValue(); |
| 173 | + return (Integer) validateObject(cls, arg, configuration); |
184 | 174 | }
|
185 | 175 |
|
186 | 176 | static Long validate(Class<?> cls, Long arg, SchemaConfiguration configuration) {
|
187 |
| - BigDecimal val = (BigDecimal) validateObject(cls, arg, configuration); |
188 |
| - return val.longValue(); |
| 177 | + return (Long) validateObject(cls, arg, configuration); |
189 | 178 | }
|
190 | 179 |
|
191 | 180 | static Float validate(Class<?> cls, Float arg, SchemaConfiguration configuration) {
|
192 |
| - BigDecimal val = (BigDecimal) validateObject(cls, arg, configuration); |
193 |
| - return val.floatValue(); |
| 181 | + return (Float) validateObject(cls, arg, configuration); |
194 | 182 | }
|
195 | 183 |
|
196 | 184 | static Double validate(Class<?> cls, Double arg, SchemaConfiguration configuration) {
|
197 |
| - BigDecimal val = (BigDecimal) validateObject(cls, arg, configuration); |
198 |
| - return val.doubleValue(); |
| 185 | + return (Double) validateObject(cls, arg, configuration); |
199 | 186 | }
|
200 | 187 |
|
201 | 188 | static String validate(Class<?> cls, String arg, SchemaConfiguration configuration) {
|
|
0 commit comments