21
21
22
22
import com .fasterxml .classmate .ResolvedType ;
23
23
import com .google .common .collect .ImmutableMap ;
24
+ import org .springframework .web .multipart .MultipartFile ;
24
25
25
26
import java .lang .reflect .Type ;
26
27
import java .math .BigDecimal ;
@@ -38,33 +39,44 @@ private Types() {
38
39
throw new UnsupportedOperationException ();
39
40
}
40
41
41
- private static final Set <String > baseTypes
42
- = newHashSet ("int" , "date" , "string" , "double" , "float" , "boolean" , "byte" , "object" , "long" , "date-time" );
42
+ private static final Set <String > baseTypes = newHashSet (
43
+ "int" ,
44
+ "date" ,
45
+ "string" ,
46
+ "double" ,
47
+ "float" ,
48
+ "boolean" ,
49
+ "byte" ,
50
+ "object" ,
51
+ "long" ,
52
+ "date-time" ,
53
+ "file" );
43
54
private static final Map <Type , String > typeNameLookup = ImmutableMap .<Type , String >builder ()
44
- .put (Long .TYPE , "long" )
45
- .put (Short .TYPE , "int" )
46
- .put (Integer .TYPE , "int" )
47
- .put (Double .TYPE , "double" )
48
- .put (Float .TYPE , "float" )
49
- .put (Byte .TYPE , "byte" )
50
- .put (Boolean .TYPE , "boolean" )
51
- .put (Character .TYPE , "string" )
55
+ .put (Long .TYPE , "long" )
56
+ .put (Short .TYPE , "int" )
57
+ .put (Integer .TYPE , "int" )
58
+ .put (Double .TYPE , "double" )
59
+ .put (Float .TYPE , "float" )
60
+ .put (Byte .TYPE , "byte" )
61
+ .put (Boolean .TYPE , "boolean" )
62
+ .put (Character .TYPE , "string" )
52
63
53
- .put (Date .class , "date-time" )
54
- .put (String .class , "string" )
55
- .put (Object .class , "object" )
56
- .put (Long .class , "long" )
57
- .put (Integer .class , "int" )
58
- .put (Short .class , "int" )
59
- .put (Double .class , "double" )
60
- .put (Float .class , "float" )
61
- .put (Boolean .class , "boolean" )
62
- .put (Byte .class , "byte" )
63
- .put (BigDecimal .class , "double" )
64
- .put (BigInteger .class , "long" )
65
- .put (Currency .class , "string" )
66
- .put (UUID .class , "string" )
67
- .build ();
64
+ .put (Date .class , "date-time" )
65
+ .put (String .class , "string" )
66
+ .put (Object .class , "object" )
67
+ .put (Long .class , "long" )
68
+ .put (Integer .class , "int" )
69
+ .put (Short .class , "int" )
70
+ .put (Double .class , "double" )
71
+ .put (Float .class , "float" )
72
+ .put (Boolean .class , "boolean" )
73
+ .put (Byte .class , "byte" )
74
+ .put (BigDecimal .class , "double" )
75
+ .put (BigInteger .class , "long" )
76
+ .put (Currency .class , "string" )
77
+ .put (UUID .class , "string" )
78
+ .put (MultipartFile .class , "file" )
79
+ .build ();
68
80
69
81
public static String typeNameFor (Type type ) {
70
82
return typeNameLookup .get (type );
0 commit comments