blob: d3b56ea09c204fd8b7a7f0c78e27190e6571d0ff [file] [log] [blame]
Stuart McCullochbb014372012-06-07 21:57:32 +00001package aQute.lib.json;
2
3import java.io.*;
4import java.lang.reflect.*;
5import java.util.*;
6
7public class BooleanHandler extends Handler {
8
9 @Override void encode(Encoder app, Object object, Map<Object, Type> visited)
10 throws IOException, Exception {
11 app.append( object.toString());
12 }
13
14 @Override Object decode(boolean s) {
15 return s;
16 }
17
18 @Override Object decode(String s) {
19 return Boolean.parseBoolean(s);
20 }
21
22 @Override Object decode(Number s) {
23 return s.intValue() != 0;
24 }
25
26 @Override Object decode() {
27 return false;
28 }
29
30}