Use local copy of latest bndlib code for pre-release testing purposes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1347815 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java b/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java
new file mode 100644
index 0000000..d4f262e
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java
@@ -0,0 +1,30 @@
+package aQute.lib.json;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.text.*;
+import java.util.*;
+
+public class DateHandler extends Handler {
+ final static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+
+ @Override void encode(Encoder app, Object object, Map<Object, Type> visited)
+ throws IOException, Exception {
+ String s;
+ synchronized (sdf) {
+ s = sdf.format((Date) object);
+ }
+ StringHandler.string(app, s);
+ }
+
+ @Override Object decode(String s) throws Exception {
+ synchronized (sdf) {
+ return sdf.parse(s);
+ }
+ }
+
+ @Override Object decode(Number s) throws Exception {
+ return new Date(s.longValue());
+ }
+
+}