This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new bbf029f  Javadocs.
bbf029f is described below

commit bbf029f19c3dfd949705a6b25e512b868ff53ba5
Author: JamesBognar <[email protected]>
AuthorDate: Sun May 20 19:46:25 2018 -0400

    Javadocs.
---
 juneau-doc/src/main/javadoc/overview.html          | 85 ++++++++++++++++------
 .../org/apache/juneau/rest/annotation/Body.java    | 18 +++--
 .../apache/juneau/rest/mock/MockHttpSession.java   |  2 +-
 .../juneau/rest/mock/MockServletRequest.java       |  2 +-
 .../juneau/rest/mock/MockServletResponse.java      |  2 +-
 5 files changed, 78 insertions(+), 31 deletions(-)

diff --git a/juneau-doc/src/main/javadoc/overview.html 
b/juneau-doc/src/main/javadoc/overview.html
index 4fe0f12..b81e7a4 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -12285,9 +12285,15 @@
                <h5 class='figure'>Example:</h5>
                <p class='bcode w800'>
        <ja>@RestMethod</ja>(name=<jsf>POST</jsf>)
-       <jk>public void</jk> addPerson(<ja>@Body</ja> Person person) { 
-               ... 
-       }
+       <jk>public void</jk> addPerson(<ja>@Body</ja> Person person) {... }
+       
+       <jc>// ...or...</jc>
+       
+       <ja>@RestMethod</ja>(name=<jsf>POST</jsf>)
+       <jk>public void</jk> addPerson(Person person) {...}
+       
+       <ja>@Body</ja>
+       <jk>public class</jk> Person {...}
                </p>
                <p>
                        This is functionally equivalent to the following code...
@@ -12310,7 +12316,7 @@
                </ul>
                
                <p>
-                       Any of the following types can be used for the 
parameter or POJO class:
+                       Any of the following types can be used for the 
parameter or POJO class (matched in the specified order):
                </p>
                <ol class='spaced-list'>
                        <li>
@@ -12371,7 +12377,7 @@
                        <js>"foo"</js>.
                </p>
                <p>
-                       When the <code>Content-Type</code> header is not 
present or match a parser, the body is pass as-is using rule #6 above.
+                       When the <code>Content-Type</code> header is not 
present or is <code>text/plain</code>, the body is pass as-is using rule #6 
above.
                        <br>For example, passing in a body of <js>"'foo'"</js> 
with no <code>Content-Type</code> header will result in the body being 
populated with
                        <js>"'foo'"</js>.
                </p>
@@ -12383,9 +12389,9 @@
                <h5 class='figure'>Examples:</h5>
                <p class='bcode w800'>
        <ja>@Body</ja>(description=<js>"POJO convertible from String"</js>)</ja>
-       <jk>public static class</jk> A {
+       <jk>public static class</jk> MyPojo {
                <jk>private</jk> String <jf>val</jf>;
-               <jk>public</jk> A(String val) {
+               <jk>public</jk> MyPojo(String val) {
                        <jk>this</jk>.<jf>val</jf> = val;
                }
                <jk>public</jk> String toString() {
@@ -12393,36 +12399,36 @@
                }
        }
 
-       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, 
path=<js>"/testPojoFromString"</js>)
-       <jk>public</jk> A testPojoFromString(A a) {
-               <jk>return</jk> a;
+       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/echoPojo"</js>)
+       <jk>public</jk> MyPojo echo(MyPojo p) {
+               <jk>return</jk> p;
        }
                </p>
                <p class='bcode w800'>
        <ja>@Body</ja>(description=<js>"Bean POJO"</js>)</ja>
-       <jk>public static class</jk> B {
+       <jk>public static class</jk> MyBean {
                <jk>public</jk> String <jf>f1</jf>;
        }
 
-       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/testBean"</js>)
-       <jk>public</jk> B testBean(B b) {
+       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/echoBean"</js>)
+       <jk>public</jk> MyBean echo(MyBean b) {
                <jk>return</jk> b;
        }
                </p>
                <p class='bcode w800'>
        <ja>@Body</ja>(description=<js>"Bean list"</js>)</ja>
-       <jk>public static class</jk> C extends LinkedList&lt;B&gt; {}
+       <jk>public static class</jk> MyBeanList <jk>extends</jk> 
LinkedList&lt;MyBean&gt; {}
        
-       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/testBeanList"</js>)
-       <jk>public</jk> C testString(C c) {
-               <jk>return</jk> c;
+       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/echoBeanList"</js>)
+       <jk>public</jk> MyBeanList echo(MyBeanList l) {
+               <jk>return</jk> l;
        }
                </p>
                <p class='bcode w800'>
        <ja>@Body</ja>(description=<js>"POJO convertible from input 
stream"</js>)</ja>
-       <jk>public static class</jk> D {
+       <jk>public static class</jk> MyPojo {
                <jk>private</jk> String <jf>val</jf>;
-               <jk>public</jk> D(InputStream is) {
+               <jk>public</jk> MyPojo(InputStream is) {
                        <jk>this</jk>.<jf>val</jf> = 
IOUtils.<jsm>read</jsm>(is);
                }
                <jk>public</jk> String toString() {
@@ -12430,12 +12436,45 @@
                }
        }
 
-       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, 
path=<js>"/testPojoFromInputStream"</js>)
-       <jk>public</jk> D testPojoFromInputStream(D d) {
-               <jk>return</jk> d;
+       <ja>@RestMethod</ja>(name=<jsf>PUT</jsf>, path=<js>"/echoPojo"</js>)
+       <jk>public</jk> MyPojo echo(MyPojo p) {
+               <jk>return</jk> p;
        }
                </p>
                
+               <p>
+                       Several of the attributes on the <ja>@Body</ja> 
annotation are used for specifying additional information for the 
auto-generated Swagger documentation.
+                       <br>These do not have any affects on the running code 
except for the generated Swagger:
+               </p>
+               <ul class='doctree'>
+                       <li class='ja'>{@link 
org.apache.juneau.rest.annotation.Body}
+                       <ul>
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#description() description()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#required() required()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#type() type()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#format() format()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#pattern() pattern()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#collectionFormat() collectionFormat()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#maximum() maximum()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#minimum() minimum()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#multipleOf() multipleOf()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#maxLength() maxLength()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#minLength() minLength()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#maxItems() maxItems()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#minItems() minItems()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#allowEmptyValue() allowEmptyValue()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#exclusiveMaximum() exclusiveMaximum()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#exclusiveMinimum() exclusiveMinimum()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#uniqueItems() uniqueItems()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#schema() schema()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#_default() _default()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#_enum() _enum()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#items() items()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#example() example()}
+                               <li class='jf'>{@link 
org.apache.juneau.rest.annotation.Body#examples() examples()}
+                       </ul>
+               </ul>
+               
                <h5 class='section'>Notes:</h5>
                <ul class='spaced-list'>
                        <li>
@@ -12444,6 +12483,8 @@
                        <li>
                                Annotation parameter values will be aggregated 
when used on both POJOs and REST methods. 
                                <br>Values on methods override values on POJO 
classes.
+                       <li>
+                               A future feature enhancement exists for 
enabling Swagger validation of the request body using the annotation values 
above.
                </ul>
                
                <h5 class='section'>See Also:</h5>
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Body.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Body.java
index 3d6beb3..94fe526 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Body.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/annotation/Body.java
@@ -31,9 +31,15 @@ import org.apache.juneau.rest.*;
  * <h5 class='section'>Example:</h5>
  * <p class='bcode w800'>
  *     <ja>@RestMethod</ja>(name=<jsf>POST</jsf>)
- *     <jk>public void</jk> addPerson(<ja>@Body</ja> Person person) {
- *             ...
- *     }
+ *     <jk>public void</jk> addPerson(<ja>@Body</ja> Person person) {...}
+ * 
+ *     <jc>// ...or...</jc>
+ * 
+ *     <ja>@RestMethod</ja>(name=<jsf>POST</jsf>)
+ *     <jk>public void</jk> addPerson(Person person) {...}
+ * 
+ *     <ja>@Body</ja>
+ *     <jk>public class</jk> Person {...}
  * </p>
  * 
  * <p>
@@ -56,8 +62,8 @@ import org.apache.juneau.rest.*;
  * </ul>
  * 
  * <p>
- * Any of the following types can be used for the parameter:
- * <ul class='spaced-list'>
+ * Any of the following types can be used as an annotated parameter (matched 
in the specified order):
+ * <ol class='spaced-list'>
  *     <li>
  *             {@link Reader}
  *             <br><ja>@Body</ja> annotation is optional.
@@ -99,7 +105,7 @@ import org.apache.juneau.rest.*;
  *                     <li><code><jk>public static</jk> T 
<jsm>forString</jsm>(String in) {...}</code>
  *             </ul>
  *             <br><code>Content-Type</code> must not be present or match an 
existing parser so that it's not parsed as a POJO.
- * </ul>
+ * </ol>
  * 
  * 
  * <h5 class='section'>Notes:</h5>
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
index 5e4be3c..6aa2069 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockHttpSession.java
@@ -22,7 +22,7 @@ import javax.servlet.http.*;
  * 
  * <h5 class='section'>See Also:</h5>
  * <ul>
- *     <li class='link'>TODO
+ *     <li class='link'><a class="doclink" 
href="../../../../../overview-summary.html#juneau-rest-server.UnitTesting">Overview
 &gt; juneau-rest-server &gt; Server-less Unit Testing of REST Interfaces</a>
  * </ul>
  */
 public class MockHttpSession implements HttpSession {
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
index d6d8ba8..d3811b2 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletRequest.java
@@ -32,7 +32,7 @@ import org.apache.juneau.utils.*;
  * 
  * <h5 class='section'>See Also:</h5>
  * <ul>
- *     <li class='link'>TODO
+ *     <li class='link'><a class="doclink" 
href="../../../../../overview-summary.html#juneau-rest-server.UnitTesting">Overview
 &gt; juneau-rest-server &gt; Server-less Unit Testing of REST Interfaces</a>
  * </ul>
  */
 public class MockServletRequest implements HttpServletRequest, MockHttpRequest 
{
diff --git 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
index d3e4298..c8f6815 100644
--- 
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
+++ 
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
@@ -31,7 +31,7 @@ import org.apache.juneau.utils.*;
  * 
  * <h5 class='section'>See Also:</h5>
  * <ul>
- *     <li class='link'>TODO
+ *     <li class='link'><a class="doclink" 
href="../../../../../overview-summary.html#juneau-rest-server.UnitTesting">Overview
 &gt; juneau-rest-server &gt; Server-less Unit Testing of REST Interfaces</a>
  * </ul>
 */
 public class MockServletResponse implements HttpServletResponse, 
MockHttpResponse {

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to