blob: 7009e0c1e0a30d5b5b38503c858556edaa792329 [file] [log] [blame]
Stuart McCullochbb014372012-06-07 21:57:32 +00001package aQute.lib.json;
2
3import java.lang.reflect.*;
4import java.util.*;
5
6public class CharacterHandler extends Handler {
7
8 @Override void encode(Encoder app, Object object, Map<Object, Type> visited)
9 throws Exception {
10 Character c = (Character) object;
11 int v = (int) c.charValue();
12 app.append( v+"" );
13 }
14
15 @Override Object decode(boolean s) {
16 return s ? 't' : 'f';
17 }
18
19 @Override Object decode(String s) {
20 return (char) Integer.parseInt(s);
21 }
22
23 @Override Object decode(Number s) {
24 return (char) s.shortValue();
25 }
26
27 @Override Object decode() {
28 return 0;
29 }
30
31}