|
1 | 1 | package de.zalando.sprocwrapper.proxy;
|
2 | 2 |
|
3 | 3 | import java.lang.reflect.Method;
|
4 |
| -import java.lang.reflect.Type; |
5 | 4 |
|
6 | 5 | import java.sql.Connection;
|
7 | 6 |
|
|
18 | 17 |
|
19 | 18 | public class GlobalValueTransformedParameter extends StoredProcedureParameter {
|
20 | 19 |
|
21 |
| - private StoredProcedureParameter forwardingStoredProcedureParameter; |
22 |
| - @SuppressWarnings("rawtypes") |
23 |
| - private ValueTransformer valueTransformerForClass; |
| 20 | + private final StoredProcedureParameter forwardingStoredProcedureParameter; |
24 | 21 |
|
25 |
| - @SuppressWarnings("rawtypes") |
26 |
| - private ObjectMapper globalObjectMapper; |
| 22 | + private final ValueTransformer<?, ?> valueTransformerForClass; |
| 23 | + |
| 24 | + private final ObjectMapper<?> globalObjectMapper; |
27 | 25 |
|
28 | 26 | public GlobalValueTransformedParameter(final ValueTransformer<?, ?> valueTransformerForClass, final Class<?> clazz,
|
29 |
| - final Type genericType, final Method m, final String typeName, final int sqlType, final int javaPosition, |
30 |
| - final boolean sensitive, final ObjectMapper<?> globalObjectMapper) throws InstantiationException, |
31 |
| - IllegalAccessException { |
| 27 | + final Method m, final String typeName, final int javaPosition, final boolean sensitive, |
| 28 | + final ObjectMapper<?> globalObjectMapper) throws InstantiationException, IllegalAccessException { |
32 | 29 | super(getValueTransformedClazz(clazz, valueTransformerForClass), m, typeName, getValueTransformedTypeId(clazz),
|
33 | 30 | javaPosition, sensitive);
|
34 | 31 |
|
@@ -64,11 +61,12 @@ public Object mapParam(final Object value, final Connection connection) {
|
64 | 61 | }
|
65 | 62 | }
|
66 | 63 |
|
| 64 | + @SuppressWarnings("unchecked") |
67 | 65 | private Object getMarshaledObject(final Object o) {
|
68 | 66 | if (globalObjectMapper != null) {
|
69 |
| - return globalObjectMapper.marshalToDb(o); |
| 67 | + return ((ObjectMapper<Object>) globalObjectMapper).marshalToDb(o); |
70 | 68 | } else {
|
71 |
| - return valueTransformerForClass.marshalToDb(o); |
| 69 | + return ((ValueTransformer<?, Object>) valueTransformerForClass).marshalToDb(o); |
72 | 70 | }
|
73 | 71 | }
|
74 | 72 |
|
|
0 commit comments