|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| package org.rblasch.convert.converters.collections; |
|
17 |
| |
|
18 |
| import org.rblasch.convert.converters.AbstractConverterFactory; |
|
19 |
| import org.rblasch.convert.type.ParameterizableType; |
|
20 |
| import org.rblasch.convert.type.Type; |
|
21 |
| import org.rblasch.convert.type.Types; |
|
22 |
| |
|
23 |
| import java.util.HashSet; |
|
24 |
| import java.util.Set; |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| public class ArrayConverterFactory extends AbstractConverterFactory { |
|
30 |
7355
| public Set create(final Type sourceType, final Type destinationType) {
|
|
31 |
7355
| final Set converters = new HashSet();
|
|
32 |
| |
|
33 |
7355
| if (sourceType instanceof ParameterizableType
|
|
34 |
| && destinationType instanceof ParameterizableType) { |
|
35 |
1691
| final ParameterizableType st = (ParameterizableType) sourceType;
|
|
36 |
1691
| final ParameterizableType dt = (ParameterizableType) destinationType;
|
|
37 |
| |
|
38 |
1691
| if (st.getType().equals(Types.findTypeByName("array"))
|
|
39 |
| && dt.getType().equals(Types.findTypeByName("array"))) { |
|
40 |
55
| final Type sct = st.getParameter(0);
|
|
41 |
55
| final Type dct = dt.getParameter(0);
|
|
42 |
| |
|
43 |
55
| if (can(sct, dct)) {
|
|
44 |
27
| final ArrayConverter c = new ArrayConverter(sct, dct, lookup(sct, dct));
|
|
45 |
27
| converters.add(c);
|
|
46 |
| } |
|
47 |
| } |
|
48 |
| } |
|
49 |
| |
|
50 |
7355
| return converters;
|
|
51 |
| } |
|
52 |
| } |