[jackson-jaxrs-providers] 29/162: add skeletal version BeanProperty impl for endpoints

Timo Aaltonen tjaalton at moszumanska.debian.org
Mon Sep 8 22:16:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

tjaalton pushed a commit to branch master
in repository jackson-jaxrs-providers.

commit d64726f148335e0d23bba4b5aa9ec54432fc3ea7
Author: Tatu Saloranta <tsaloranta at gmail.com>
Date:   Tue Mar 26 17:42:30 2013 -0700

    add skeletal version BeanProperty impl for endpoints
---
 .../jackson/jaxrs/util/EndpointAsBeanProperty.java | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/base/src/main/java/com/fasterxml/jackson/jaxrs/util/EndpointAsBeanProperty.java b/base/src/main/java/com/fasterxml/jackson/jaxrs/util/EndpointAsBeanProperty.java
new file mode 100644
index 0000000..e487e64
--- /dev/null
+++ b/base/src/main/java/com/fasterxml/jackson/jaxrs/util/EndpointAsBeanProperty.java
@@ -0,0 +1,42 @@
+package com.fasterxml.jackson.jaxrs.util;
+
+import java.lang.annotation.Annotation;
+
+import com.fasterxml.jackson.databind.BeanProperty;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.introspect.AnnotationMap;
+
+/**
+ * {@link BeanProperty} implementation used for passing annotations
+ * from JAX-RS endpoint into Jackson. This tries to imitate behavior
+ * one would get if actual resource method was used as POJO property;
+ * ideally this would be how implementation works but due JAX-RS API
+ * limitations, we are only given annotations associated, and that
+ * has to do.
+ */
+public class EndpointAsBeanProperty
+    extends BeanProperty.Std
+{
+    public final static String ENDPOINT_NAME = "JAX-RS/endpoint";
+    
+    private final static AnnotationMap NO_ANNOTATIONS = new AnnotationMap();
+
+    public final AnnotationMap _annotations;
+
+    public EndpointAsBeanProperty(JavaType type, Annotation[] annotations)
+    {
+        // TODO: find and pass wrapper; isRequired marker?
+        super(ENDPOINT_NAME, type, /*PropertyName wrapperName*/ null,
+                null, null,
+                /* isRequired */ false);
+        boolean hasAnn = (annotations == null || annotations.length == 0);
+        if (hasAnn) {
+            _annotations = new AnnotationMap();
+            for (Annotation a : annotations) {
+                _annotations.add(a);
+            }
+        } else {
+            _annotations = NO_ANNOTATIONS;
+        }
+    }
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-jaxrs-providers.git



More information about the pkg-java-commits mailing list