You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2017/06/21 03:40:39 UTC

incubator-streams git commit: resolves STREAMS-516

Repository: incubator-streams
Updated Branches:
  refs/heads/master bd91d2687 -> b75753925


resolves STREAMS-516


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

Branch: refs/heads/master
Commit: b757539256a8f96c33ad076784528a601043a8e2
Parents: bd91d26
Author: Steve Blackmon <sb...@apache.org>
Authored: Tue Jun 20 22:38:54 2017 -0500
Committer: Steve Blackmon <sb...@apache.org>
Committed: Tue Jun 20 22:38:54 2017 -0500

----------------------------------------------------------------------
 .../streams/plugins/JuneauPojoAnnotator.java    | 22 ++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/b7575392/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/JuneauPojoAnnotator.java
----------------------------------------------------------------------
diff --git a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/JuneauPojoAnnotator.java b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/JuneauPojoAnnotator.java
index 64143da..437feb5 100644
--- a/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/JuneauPojoAnnotator.java
+++ b/streams-plugins/streams-plugin-pojo/src/main/java/org/apache/streams/plugins/JuneauPojoAnnotator.java
@@ -19,6 +19,9 @@
 
 package org.apache.streams.plugins;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.sun.codemodel.JDefinedClass;
+import com.sun.codemodel.JFieldVar;
 import com.sun.codemodel.JMethod;
 import org.apache.juneau.annotation.BeanProperty;
 import org.jsonschema2pojo.AbstractAnnotator;
@@ -29,6 +32,21 @@ import org.jsonschema2pojo.AbstractAnnotator;
 public class JuneauPojoAnnotator extends AbstractAnnotator {
 
   /**
+   * Add the necessary annotation to associate a Java field with a
+   * JSON property
+   *
+   * @param field
+   *            the field that holds the value of the given JSON property
+   * @param propertyName
+   *            the name of the JSON property that this field holds
+   */
+  public void propertyField(JFieldVar field, JDefinedClass clazz,
+                            String propertyName, JsonNode propertyNode) {
+    field.annotate(BeanProperty.class).param("value", propertyName);
+  }
+
+
+  /**
    * Add the necessary annotation to mark a Java method as the getter for a
    * JSON property
    *
@@ -39,7 +57,7 @@ public class JuneauPojoAnnotator extends AbstractAnnotator {
    *            the name of the JSON property that this getter gets
    */
   public void propertyGetter(JMethod getter, String propertyName) {
-    getter.annotate(BeanProperty.class).param("name", propertyName);
+    getter.annotate(BeanProperty.class).param("value", propertyName);
   }
 
   /**
@@ -53,7 +71,7 @@ public class JuneauPojoAnnotator extends AbstractAnnotator {
    *            the name of the JSON property that this setter sets
    */
   public void propertySetter(JMethod setter, String propertyName) {
-    setter.annotate(BeanProperty.class).param("name", propertyName);
+    setter.annotate(BeanProperty.class).param("value", propertyName);
   }
 
   /**