|
6 | 6 | import java.net.URI;
|
7 | 7 | import java.net.URL;
|
8 | 8 | import java.util.Calendar;
|
| 9 | +import java.util.Currency; |
9 | 10 | import java.util.Date;
|
10 | 11 | import java.util.Locale;
|
11 | 12 | import java.util.UUID;
|
@@ -46,6 +47,7 @@ public class StdKeyDeserializer extends KeyDeserializer
|
46 | 47 | public final static int TYPE_URI = 13;
|
47 | 48 | public final static int TYPE_URL = 14;
|
48 | 49 | public final static int TYPE_CLASS = 15;
|
| 50 | + public final static int TYPE_CURRENCY = 16; |
49 | 51 |
|
50 | 52 | final protected int _kind;
|
51 | 53 | final protected Class<?> _keyClass;
|
@@ -104,6 +106,9 @@ public static StdKeyDeserializer forType(Class<?> raw)
|
104 | 106 | } else if (raw == Locale.class) {
|
105 | 107 | FromStringDeserializer<?> deser = FromStringDeserializer.findDeserializer(Locale.class);
|
106 | 108 | return new StdKeyDeserializer(TYPE_LOCALE, raw, deser);
|
| 109 | + } else if (raw == Currency.class) { |
| 110 | + FromStringDeserializer<?> deser = FromStringDeserializer.findDeserializer(Currency.class); |
| 111 | + return new StdKeyDeserializer(TYPE_CURRENCY, raw, deser); |
107 | 112 | } else {
|
108 | 113 | return null;
|
109 | 114 | }
|
@@ -183,7 +188,12 @@ protected Object _parse(String key, DeserializationContext ctxt) throws Exceptio
|
183 | 188 | } catch (IOException e) {
|
184 | 189 | throw ctxt.weirdKeyException(_keyClass, key, "unable to parse key as locale");
|
185 | 190 | }
|
186 |
| - |
| 191 | + case TYPE_CURRENCY: |
| 192 | + try { |
| 193 | + return _deser._deserialize(key, ctxt); |
| 194 | + } catch (IOException e) { |
| 195 | + throw ctxt.weirdKeyException(_keyClass, key, "unable to parse key as currency"); |
| 196 | + } |
187 | 197 | case TYPE_DATE:
|
188 | 198 | return ctxt.parseDate(key);
|
189 | 199 | case TYPE_CALENDAR:
|
|
0 commit comments