You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2022/07/03 10:52:02 UTC
[juneau] branch master updated: Javadocs
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 2c547eb83 Javadocs
2c547eb83 is described below
commit 2c547eb835e6ae8e0be9ae997c22d175b040ec99
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Sun Jul 3 06:51:42 2022 -0400
Javadocs
---
.../java/org/apache/juneau/marshaller/OpenApi.java | 36 ++++++++++++++++++
juneau-doc/docs/ReleaseNotes/8.2.0.html | 2 +-
.../docs/Topics/01.Overview/01.o.Marshalling.html | 15 ++++----
.../docs/Topics/01.Overview/02.o.EndToEndRest.html | 6 +--
.../Topics/01.Overview/07.o.FluentAssertions.html | 18 ++++-----
juneau-doc/src/main/javadoc/overview.html | 43 +++++++++++-----------
.../main/javadoc/resources/fragments/rntoc.html | 2 +-
7 files changed, 78 insertions(+), 44 deletions(-)
diff --git a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshaller/OpenApi.java b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshaller/OpenApi.java
index fc923837a..6a87b5c23 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshaller/OpenApi.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/marshaller/OpenApi.java
@@ -17,6 +17,7 @@ import java.lang.reflect.*;
import java.nio.charset.*;
import org.apache.juneau.*;
+import org.apache.juneau.httppart.*;
import org.apache.juneau.oapi.*;
import org.apache.juneau.parser.*;
import org.apache.juneau.serializer.*;
@@ -122,6 +123,26 @@ public class OpenApi extends CharMarshaller {
return DEFAULT.read(input, type);
}
+ /**
+ * Parses an OpenApi input object to the specified Java type.
+ *
+ * <p>
+ * A shortcut for calling <c><jsf>DEFAULT</jsf>.read(<jv>input</jv>, <jv>type</jv>)</c>.
+ *
+ * @param <T> The class type of the object being created.
+ * @param partType The part type being created.
+ * @param schema The part type schema. Can be <jk>null</jk>.
+ * @param input
+ * The input.
+ * @param type The object type to create.
+ * @return The parsed object.
+ * @throws ParseException Malformed input encountered.
+ * @throws IOException Thrown by underlying stream.
+ */
+ public static <T> T to(HttpPartType partType, HttpPartSchema schema, String input, Class<T> type) throws ParseException, IOException {
+ return ((OpenApiParser)DEFAULT.getParser()).parse(partType, schema, input, type);
+ }
+
/**
* Parses an OpenApi input string to the specified Java type.
*
@@ -221,4 +242,19 @@ public class OpenApi extends CharMarshaller {
DEFAULT.write(object, output);
return output;
}
+
+ /**
+ * Serializes a Java object to an OpenApi output.
+ *
+ * <p>
+ * A shortcut for calling <c><jsf>DEFAULT</jsf>.write(<jv>output</jv>)</c>.
+ * @param partType The part type being parsed.
+ * @param schema The part schema. Can be <jk>null</jk>.
+ * @param object The object to serialize.
+ * @return The output object.
+ * @throws SerializeException If a problem occurred trying to convert the output.
+ */
+ public static String of(HttpPartType partType, HttpPartSchema schema, Object object) throws SerializeException {
+ return ((OpenApiSerializer)DEFAULT.getSerializer()).serialize(partType, schema, object);
+ }
}
diff --git a/juneau-doc/docs/ReleaseNotes/8.2.0.html b/juneau-doc/docs/ReleaseNotes/8.2.0.html
index 55374c818..f44be8867 100644
--- a/juneau-doc/docs/ReleaseNotes/8.2.0.html
+++ b/juneau-doc/docs/ReleaseNotes/8.2.0.html
@@ -13,7 +13,7 @@
***************************************************************************************************************************/
-->
-8.2.0 (TBD)
+8.2.0 (Oct 14, 2020)
<div class='topic'>
<p>
diff --git a/juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html b/juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html
index 442c5fc3c..c473302d2 100644
--- a/juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html
+++ b/juneau-doc/docs/Topics/01.Overview/01.o.Marshalling.html
@@ -61,7 +61,7 @@
| String <jv>json</jv> = Json.<jsm>of</jsm>(<jk>new</jk> Person());
</p>
<p>
- Parsing back into POJOs is equally simple for any of the supported languages
+ Parsing back into POJOs is equally simple for any of the supported languages.
Language fragments are also supported.
</p>
<p class='bjava'>
@@ -113,7 +113,6 @@
</p>
<p>
Many POJOs such as primitives, beans, collections, arrays, and classes with various known constructors and methods are serializable out-of-the-box.
- For other objects, "transforms" allow you to perform various mutations on them before serialization and after parsing.
</p>
<p>
{@doc jm.Swaps Swaps} allow you to replace non-serializable objects with serializable equivalents.
@@ -187,14 +186,14 @@
Config annotations are extensively used in the REST Servlet APIs to configure how POJOs are marshalled through REST interfaces.
</p>
<p>
- Configuration variables also support embedded variables for resolving settings at runtime.
+ Config variables also support embedded variables for resolving settings at runtime.
</p>
<p class='bjava'>
| <jc>// Sort properties depending on value of system property "sortProperties".</jc>
| <ja>@BeanConfig</ja>(sortProperties=<js>"$S{sortProperties,false}"</js>)
</p>
<p>
- Default values for configuration settings can be overridden via system properties or environment variables.
+ Default values for config settings can be overridden via system properties or environment variables.
For example, the system property "BeanContext.sortProperties" or environment variable "BEANCONTEXT_SORTPROPERTIES" can be
used to set the default value for the sort properties setting.
</p>
@@ -263,7 +262,7 @@
</p>
<p class='bjava'>
| WriterSerializer <jv>serializer</jv> = SimpleJsonSerializer.<jsf>DEFAULT</jsf>;
- | <jsm>assertEquals</jsm>(<js>"{foo:'bar',baz:123}"</js>, <jv>serializer</jv>.toString(<jv>myPojo</jv>));
+ | <jsm>assertString</jsm>(<jv>serializer</jv>.toString(<jv>myPojo</jv>)).is(<js>"{foo:'bar',baz:123}"</js>);
</p>
<ul class='seealso'>
<li class='link'>{@doc jm.SimplifiedJson} for more information.
@@ -323,7 +322,7 @@
| Object <jv>value</jv> = <jk>new long</jk>[][]{{1,2,3},{4,5,6},{7,8,9}};
|
| <jc>// Produces "1,2,3|4,5,6|7,8,9"</jc>
- | String <jv>output</jv> = OpenApiSerializer.<jsf>DEFAULT</jsf>.serialize(HttpPartType.<jsf>HEADER</jsf>, <jv>schema</jv>, <jv>value</jv>);
+ | String <jv>output</jv> = OpenApi.<jsm>of</jsm>(HttpPartType.<jsf>HEADER</jsf>, <jv>schema</jv>, <jv>value</jv>);
</p>
<p>
Schema-based serialization and parsing is used heavily in both the server and client REST APIs with built-in schema
@@ -333,8 +332,8 @@
| <jc>// REST server method with HTTP parts using schema validation.</jc>
| <ja>@RestGet</ja>
| <jk>public void</jk> doGet(
- | <ja>@Query</ja>(name=<js>"myParam"</js>, min=1, max=32) <jk>int</jk> <jv>myParam</jv>,
- | <ja>@Header</ja>(<js>"MyHeader"</js>, pattern=<js>"foo.*"</js>) String <jv>p2</jv>
+ | <ja>@Query</ja>(name=<js>"myParam"</js>, schema=<ja>@Schema</ja>(min=1, max=32)) <jk>int</jk> <jv>myParam</jv>,
+ | <ja>@Header</ja>(<js>"MyHeader"</js>, schema=<ja>@Schema</ja>(pattern=<js>"foo.*"</js>)) String <jv>p2</jv>
| ) {...}
</p>
<ul class='seealso'>
diff --git a/juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html b/juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html
index 27f44eba7..a913bba62 100644
--- a/juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html
+++ b/juneau-doc/docs/Topics/01.Overview/02.o.EndToEndRest.html
@@ -27,7 +27,7 @@
</p>
<p class='bjava'>
| <ja>@Rest</ja>(path=<js>"/petstore"</js>)
- | <jk>public class</jk> PetStore {
+ | <jk>public class</jk> PetStoreRest {
|
| <ja>@RestPost</ja>(path=<js>"/pets"</js>, guards=AdminGuard.<jk>class</jk>)
| <jk>public</jk> Ok addPet(
@@ -45,7 +45,7 @@
</p>
<p class='bjava'>
| <ja>@Remote</ja>(path=<js>"/petstore"</js>)
- | <jk>public interface</jk> PetStoreService {
+ | <jk>public interface</jk> PetStoreClient {
|
| <ja>@RemotePost</ja>(<js>"/pets"</js>)
| Ok addPet(
@@ -67,7 +67,7 @@
| RestClient <jv>client</jv> = RestClient.<jsm>create</jsm>().simpleJson().basicAuth(...).build();
|
| <jc>// Instantiate our proxy interface.</jc>
- | PetStore <jv>store</jv> = <jv>client</jv>.getRemote(PetStore.<jk>class</jk>, <js>"http://localhost:10000"</js>);
+ | PetStoreClient <jv>store</jv> = <jv>client</jv>.getRemote(PetStoreClient.<jk>class</jk>, <js>"http://localhost:10000"</js>);
|
| <jc>// Use it to create a pet.</jc>
| CreatePet <jv>createPet</jv> = <jk>new</jk> CreatePet(<js>"Fluffy"</js>, 9.99);
diff --git a/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html b/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html
index 008c4420f..cb564c787 100644
--- a/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html
+++ b/juneau-doc/docs/Topics/01.Overview/07.o.FluentAssertions.html
@@ -26,14 +26,14 @@
|
| <jc>// Check the contents of a string.</jc>
| <jsm>assertString</jsm>(<js>"foo, bar"</js>)
- | .split(<js>","</js>)
- | .trim()
- | .has(<js>"foo"</js>, <js>"bar"</js>);
+ | .asSplit(<js>","</js>)
+ | .asTrimmed()
+ | .is(<js>"foo"</js>, <js>"bar"</js>);
|
| <jc>// Extract a subset of properties from a list of beans and compare using Simplified JSON.</jc>
| List<MyBean> <jv>myListOfBeans</jv> = ...;
| <jsm>assertBeanList</jsm>(<jv>myListOfBeans</jv>)
- | .extract(<js>"a,b"</js>)
+ | .asPropertyMap(<js>"a,b"</js>)
| .asJson().is(<js>"[{a:1,b:'foo'}]"</js>);
|
| <jc>// Perform an arbitrary Predicate check against a bean.</jc>
@@ -45,15 +45,15 @@
| <jc>// 3 entries are [foo, bar*, null] using assertion predicates.</jc>
| List<String> <jv>myListOfStrings</jv> = ...;
| <jsm>assertStringList</jsm>(<jv>myListOfStrings</jv>)
- | .size().isLt(10)
- | .first(3)
- | .each(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
+ | .asSize().isLt(10)
+ | .asFirst(3)
+ | .is(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
|
| <jc>// Check that an exception is thrown and is the specified type and has the specified message.</jc>
| <jsm>assertThrown</jsm>(()-><jv>myBean</jv>.runBadMethod())
- | .exists()
+ | .isExists()
| .isExactType(RuntimeException.<jk>class</jk>)
- | .message().is(<js>"foo"</js>);
+ | .asMessage().is(<js>"foo"</js>);
</p>
<p>
The Assertions APIs are used throughout the REST client and server APIs for performing inline assertions on REST requests and responses.
diff --git a/juneau-doc/src/main/javadoc/overview.html b/juneau-doc/src/main/javadoc/overview.html
index 515c20617..f9f0fe30f 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -765,7 +765,7 @@
String <jv>json</jv> = Json.<jsm>of</jsm>(<jk>new</jk> Person());
</p>
<p>
- Parsing back into POJOs is equally simple for any of the supported languages
+ Parsing back into POJOs is equally simple for any of the supported languages.
Language fragments are also supported.
</p>
<p class='bjava'>
@@ -817,7 +817,6 @@
</p>
<p>
Many POJOs such as primitives, beans, collections, arrays, and classes with various known constructors and methods are serializable out-of-the-box.
- For other objects, "transforms" allow you to perform various mutations on them before serialization and after parsing.
</p>
<p>
{@doc jm.Swaps Swaps} allow you to replace non-serializable objects with serializable equivalents.
@@ -891,14 +890,14 @@
Config annotations are extensively used in the REST Servlet APIs to configure how POJOs are marshalled through REST interfaces.
</p>
<p>
- Configuration variables also support embedded variables for resolving settings at runtime.
+ Config variables also support embedded variables for resolving settings at runtime.
</p>
<p class='bjava'>
<jc>// Sort properties depending on value of system property "sortProperties".</jc>
<ja>@BeanConfig</ja>(sortProperties=<js>"$S{sortProperties,false}"</js>)
</p>
<p>
- Default values for configuration settings can be overridden via system properties or environment variables.
+ Default values for config settings can be overridden via system properties or environment variables.
For example, the system property "BeanContext.sortProperties" or environment variable "BEANCONTEXT_SORTPROPERTIES" can be
used to set the default value for the sort properties setting.
</p>
@@ -967,7 +966,7 @@
</p>
<p class='bjava'>
WriterSerializer <jv>serializer</jv> = SimpleJsonSerializer.<jsf>DEFAULT</jsf>;
- <jsm>assertEquals</jsm>(<js>"{foo:'bar',baz:123}"</js>, <jv>serializer</jv>.toString(<jv>myPojo</jv>));
+ <jsm>assertString</jsm>(<jv>serializer</jv>.toString(<jv>myPojo</jv>)).is(<js>"{foo:'bar',baz:123}"</js>);
</p>
<ul class='seealso'>
<li class='link'>{@doc jm.SimplifiedJson} for more information.
@@ -1027,7 +1026,7 @@
Object <jv>value</jv> = <jk>new long</jk>[][]{{1,2,3},{4,5,6},{7,8,9}};
<jc>// Produces "1,2,3|4,5,6|7,8,9"</jc>
- String <jv>output</jv> = OpenApiSerializer.<jsf>DEFAULT</jsf>.serialize(HttpPartType.<jsf>HEADER</jsf>, <jv>schema</jv>, <jv>value</jv>);
+ String <jv>output</jv> = OpenApi.<jsm>of</jsm>(HttpPartType.<jsf>HEADER</jsf>, <jv>schema</jv>, <jv>value</jv>);
</p>
<p>
Schema-based serialization and parsing is used heavily in both the server and client REST APIs with built-in schema
@@ -1037,8 +1036,8 @@
<jc>// REST server method with HTTP parts using schema validation.</jc>
<ja>@RestGet</ja>
<jk>public void</jk> doGet(
- <ja>@Query</ja>(name=<js>"myParam"</js>, min=1, max=32) <jk>int</jk> <jv>myParam</jv>,
- <ja>@Header</ja>(<js>"MyHeader"</js>, pattern=<js>"foo.*"</js>) String <jv>p2</jv>
+ <ja>@Query</ja>(name=<js>"myParam"</js>, schema=<ja>@Schema</ja>(min=1, max=32)) <jk>int</jk> <jv>myParam</jv>,
+ <ja>@Header</ja>(<js>"MyHeader"</js>, schema=<ja>@Schema</ja>(pattern=<js>"foo.*"</js>)) String <jv>p2</jv>
) {...}
</p>
<ul class='seealso'>
@@ -1155,7 +1154,7 @@
</p>
<p class='bjava'>
<ja>@Rest</ja>(path=<js>"/petstore"</js>)
- <jk>public class</jk> PetStore {
+ <jk>public class</jk> PetStoreRest {
<ja>@RestPost</ja>(path=<js>"/pets"</js>, guards=AdminGuard.<jk>class</jk>)
<jk>public</jk> Ok addPet(
@@ -1173,7 +1172,7 @@
</p>
<p class='bjava'>
<ja>@Remote</ja>(path=<js>"/petstore"</js>)
- <jk>public interface</jk> PetStoreService {
+ <jk>public interface</jk> PetStoreClient {
<ja>@RemotePost</ja>(<js>"/pets"</js>)
Ok addPet(
@@ -1195,7 +1194,7 @@
RestClient <jv>client</jv> = RestClient.<jsm>create</jsm>().simpleJson().basicAuth(...).build();
<jc>// Instantiate our proxy interface.</jc>
- PetStore <jv>store</jv> = <jv>client</jv>.getRemote(PetStore.<jk>class</jk>, <js>"http://localhost:10000"</js>);
+ PetStoreClient <jv>store</jv> = <jv>client</jv>.getRemote(PetStoreClient.<jk>class</jk>, <js>"http://localhost:10000"</js>);
<jc>// Use it to create a pet.</jc>
CreatePet <jv>createPet</jv> = <jk>new</jk> CreatePet(<js>"Fluffy"</js>, 9.99);
@@ -1860,14 +1859,14 @@
<jc>// Check the contents of a string.</jc>
<jsm>assertString</jsm>(<js>"foo, bar"</js>)
- .split(<js>","</js>)
- .trim()
- .has(<js>"foo"</js>, <js>"bar"</js>);
+ .asSplit(<js>","</js>)
+ .asTrimmed()
+ .is(<js>"foo"</js>, <js>"bar"</js>);
<jc>// Extract a subset of properties from a list of beans and compare using Simplified JSON.</jc>
List<MyBean> <jv>myListOfBeans</jv> = ...;
<jsm>assertBeanList</jsm>(<jv>myListOfBeans</jv>)
- .extract(<js>"a,b"</js>)
+ .asPropertyMap(<js>"a,b"</js>)
.asJson().is(<js>"[{a:1,b:'foo'}]"</js>);
<jc>// Perform an arbitrary Predicate check against a bean.</jc>
@@ -1879,15 +1878,15 @@
<jc>// 3 entries are [foo, bar*, null] using assertion predicates.</jc>
List<String> <jv>myListOfStrings</jv> = ...;
<jsm>assertStringList</jsm>(<jv>myListOfStrings</jv>)
- .size().isLt(10)
- .first(3)
- .each(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
+ .asSize().isLt(10)
+ .asFirst(3)
+ .is(<jsm>eq</jsm>(<js>"foo"</js>),<jsm>match</jsm>(<js>"bar*"</js>),<jsm>isNull</jsm>())
<jc>// Check that an exception is thrown and is the specified type and has the specified message.</jc>
<jsm>assertThrown</jsm>(()-><jv>myBean</jv>.runBadMethod())
- .exists()
+ .isExists()
.isExactType(RuntimeException.<jk>class</jk>)
- .message().is(<js>"foo"</js>);
+ .asMessage().is(<js>"foo"</js>);
</p>
<p>
The Assertions APIs are used throughout the REST client and server APIs for performing inline assertions on REST requests and responses.
@@ -29053,7 +29052,7 @@
<li><p><a class='doclink' href='#8.1.1'>8.1.1 (Sept 20, 2019)</a></p>
<li><p><a class='doclink' href='#8.1.2'>8.1.2 (Dec 01, 2019)</a></p>
<li><p><a class='doclink' href='#8.1.3'>8.1.3 (Jan 20, 2020)</a></p>
-<li><p><a class='doclink' href='#8.2.0'>8.2.0 (TBD)</a></p>
+<li><p><a class='doclink' href='#8.2.0'>8.2.0 (Oct 14, 2020)</a></p>
<li><p><a class='doclink' href='#9.0.0'>9.0.0 (TBD)</a></p>
</ul>
@@ -35929,7 +35928,7 @@
<!-- ==================================================================================================== -->
-<h3 class='topic' onclick='toggle(this)'><a href='#8.2.0' id='8.2.0'>8.2.0 (TBD)</a></h3>
+<h3 class='topic' onclick='toggle(this)'><a href='#8.2.0' id='8.2.0'>8.2.0 (Oct 14, 2020)</a></h3>
<div class='topic'><!-- START: 8.2.0 -->
<div class='topic'>
<p>
diff --git a/juneau-doc/src/main/javadoc/resources/fragments/rntoc.html b/juneau-doc/src/main/javadoc/resources/fragments/rntoc.html
index 1de0db442..67644c954 100644
--- a/juneau-doc/src/main/javadoc/resources/fragments/rntoc.html
+++ b/juneau-doc/src/main/javadoc/resources/fragments/rntoc.html
@@ -91,6 +91,6 @@
<li><p><a class='doclink' href='{OVERVIEW_URL}#8.1.1'>8.1.1 (Sept 20, 2019)</a></p>
<li><p><a class='doclink' href='{OVERVIEW_URL}#8.1.2'>8.1.2 (Dec 01, 2019)</a></p>
<li><p><a class='doclink' href='{OVERVIEW_URL}#8.1.3'>8.1.3 (Jan 20, 2020)</a></p>
-<li><p><a class='doclink' href='{OVERVIEW_URL}#8.2.0'>8.2.0 (TBD)</a></p>
+<li><p><a class='doclink' href='{OVERVIEW_URL}#8.2.0'>8.2.0 (Oct 14, 2020)</a></p>
<li><p><a class='doclink' href='{OVERVIEW_URL}#9.0.0'>9.0.0 (TBD)</a></p>
</ul>