camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: Add a type converter for java.sql.Timestamp
Date Sat, 14 Feb 2015 13:49:39 GMT
Repository: camel
Updated Branches:
  refs/heads/master c126376ba -> 25f4be9e3


Add a type converter for java.sql.Timestamp


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a560d012
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a560d012
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a560d012

Branch: refs/heads/master
Commit: a560d012c6d55a59db50ae87eb525e342a1bd1e9
Parents: c126376
Author: Daniel Pocock <daniel@pocock.pro>
Authored: Fri Nov 28 08:59:49 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Feb 14 14:42:45 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/converter/SQLConverter.java    | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a560d012/camel-core/src/main/java/org/apache/camel/converter/SQLConverter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/converter/SQLConverter.java b/camel-core/src/main/java/org/apache/camel/converter/SQLConverter.java
new file mode 100644
index 0000000..3dbbed3
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/converter/SQLConverter.java
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter;
+
+import java.sql.Timestamp;
+
+import org.apache.camel.Converter;
+
+/**
+ * Date and time related converters.
+ */
+@Converter
+public final class SQLConverter {
+
+    /**
+     * Utility classes should not have a public constructor.
+     */
+    private SQLConverter() {
+    }
+
+    @Converter
+    public static Timestamp toTimestamp(Long l) {
+        return l != null ? new Timestamp(l) : null;
+    }
+    
+    @Converter
+    public static Long toLong(Timestamp ts) {
+        return ts != null ? ts.getTime() : null;
+    }
+}


Mime
View raw message