johnzon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject johnzon git commit: JOHNZON-119 WildcardConfigurableJohnzonProvider missing setSerializeValueFilter
Date Tue, 30 May 2017 08:36:45 GMT
Repository: johnzon
Updated Branches:
  refs/heads/master 0a45f1968 -> 18c215ce7


JOHNZON-119 WildcardConfigurableJohnzonProvider missing setSerializeValueFilter


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

Branch: refs/heads/master
Commit: 18c215ce784f8f308417d4d9027d11f1b0ac12e0
Parents: 0a45f19
Author: rmannibucau <rmannibucau@apache.org>
Authored: Tue May 30 10:36:40 2017 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Tue May 30 10:36:40 2017 +0200

----------------------------------------------------------------------
 .../jaxrs/WildcardConfigurableJohnzonProvider.java     | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/johnzon/blob/18c215ce/johnzon-jaxrs/src/main/java/org/apache/johnzon/jaxrs/WildcardConfigurableJohnzonProvider.java
----------------------------------------------------------------------
diff --git a/johnzon-jaxrs/src/main/java/org/apache/johnzon/jaxrs/WildcardConfigurableJohnzonProvider.java
b/johnzon-jaxrs/src/main/java/org/apache/johnzon/jaxrs/WildcardConfigurableJohnzonProvider.java
index 445d810..34bc456 100644
--- a/johnzon-jaxrs/src/main/java/org/apache/johnzon/jaxrs/WildcardConfigurableJohnzonProvider.java
+++ b/johnzon-jaxrs/src/main/java/org/apache/johnzon/jaxrs/WildcardConfigurableJohnzonProvider.java
@@ -19,6 +19,7 @@
 package org.apache.johnzon.jaxrs;
 
 import org.apache.johnzon.mapper.MapperBuilder;
+import org.apache.johnzon.mapper.SerializeValueFilter;
 import org.apache.johnzon.mapper.access.AccessMode;
 
 import javax.json.JsonReaderFactory;
@@ -34,6 +35,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Type;
 import java.util.Comparator;
 import java.util.List;
@@ -223,4 +225,15 @@ public class WildcardConfigurableJohnzonProvider<T> implements
MessageBodyWriter
     public void setUseBigDecimalForFloats(final boolean useBigDecimalForFloats) {
         builder.setUseBigDecimalForFloats(useBigDecimalForFloats);
     }
+
+    public void setSerializeValueFilter(final String val) {
+        try {
+            builder.setSerializeValueFilter(SerializeValueFilter.class.cast(
+                    Thread.currentThread().getContextClassLoader().loadClass(val).getConstructor().newInstance()));
+        } catch (final InstantiationException | IllegalAccessException | NoSuchMethodException
| ClassNotFoundException e) {
+            throw new IllegalArgumentException(e);
+        } catch (InvocationTargetException e) {
+            throw new IllegalArgumentException(e.getCause());
+        }
+    }
 }


Mime
View raw message