From 8ddb68d5576aa884428ba5edf813783a081da8cc Mon Sep 17 00:00:00 2001 From: Josiah Noel <32279667+SentryMan@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:46:51 -0500 Subject: [PATCH] Add `package-info.java`s (#97) * javadocs * Update Jex.java * Update JdkJexServer.java * package info --- .../src/main/java/io/avaje/jex/Routing.java | 23 +++++++------------ .../io/avaje/jex/StaticContentConfig.java | 4 ++-- .../io/avaje/jex/core/json/package-info.java | 2 ++ .../java/io/avaje/jex/http/package-info.java | 2 ++ .../io/avaje/jex/security/package-info.java | 2 ++ .../java/io/avaje/jex/spi/package-info.java | 6 ++++- avaje-jex/src/main/java/module-info.java | 18 +++++++++++++++ 7 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 avaje-jex/src/main/java/io/avaje/jex/core/json/package-info.java create mode 100644 avaje-jex/src/main/java/io/avaje/jex/http/package-info.java create mode 100644 avaje-jex/src/main/java/io/avaje/jex/security/package-info.java diff --git a/avaje-jex/src/main/java/io/avaje/jex/Routing.java b/avaje-jex/src/main/java/io/avaje/jex/Routing.java index 40c7cd39..022761e5 100644 --- a/avaje-jex/src/main/java/io/avaje/jex/Routing.java +++ b/avaje-jex/src/main/java/io/avaje/jex/Routing.java @@ -8,10 +8,11 @@ import io.avaje.jex.security.Role; +/** Routing abstraction. */ public sealed interface Routing permits DefaultRouting { - /** Add the routes provided by the Routing HttpService. */ - Routing add(Routing.HttpService routes); + /** Add the routes provided by the given HttpService. */ + Routing add(Routing.HttpService service); /** Add all the routes provided by the Routing Services. */ Routing addAll(Collection routes); @@ -47,12 +48,12 @@ public sealed interface Routing permits DefaultRouting { Routing withRoles(Role... permittedRoles); /** - * Registers an error handler that handles the given type of exceptions. - * This will replace an existing error handler for the same exception class. + * Registers an error handler that handles the given type of exceptions. This will replace an + * existing error handler for the same exception class. * * @param exceptionClass the type of exception to handle by this handler - * @param handler the error handler - * @param exception type + * @param handler the error handler + * @param exception type * @return updated routing */ Routing error(Class exceptionClass, ExceptionHandler handler); @@ -87,7 +88,7 @@ public sealed interface Routing permits DefaultRouting { /** Add a filter for all requests. */ Routing filter(HttpFilter handler); - /** Add a preprocessing filter for all requests. */ + /** Add a pre-processing filter for all requests. */ default Routing before(Consumer handler) { return filter( @@ -154,21 +155,13 @@ interface Entry { /** The type of route entry. */ enum Type { - /** Http GET. */ GET, - /** Http POST. */ POST, - /** HTTP PUT. */ PUT, - /** HTTP PATCH. */ PATCH, - /** HTTP DELETE. */ DELETE, - /** HTTP HEAD. */ HEAD, - /** HTTP TRACE. */ TRACE, - /** HTTP OPTIONS. */ OPTIONS; } } diff --git a/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java b/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java index 72e55c3f..962d3093 100644 --- a/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java +++ b/avaje-jex/src/main/java/io/avaje/jex/StaticContentConfig.java @@ -31,7 +31,7 @@ static StaticContentConfig create() { /** * Sets the file to serve, or the folder your files are located in. (default: "/public/") * - * @param root the root directory + * @param resource the root directory * @return the updated configuration */ StaticContentConfig resource(String resource); @@ -91,7 +91,7 @@ static StaticContentConfig create() { */ StaticContentConfig location(ResourceLocation location); - /** the resource location */ + /** Resource location */ public enum ResourceLocation { CLASS_PATH, FILE diff --git a/avaje-jex/src/main/java/io/avaje/jex/core/json/package-info.java b/avaje-jex/src/main/java/io/avaje/jex/core/json/package-info.java new file mode 100644 index 00000000..83defa32 --- /dev/null +++ b/avaje-jex/src/main/java/io/avaje/jex/core/json/package-info.java @@ -0,0 +1,2 @@ +/** Optional JsonServices */ +package io.avaje.jex.core.json; diff --git a/avaje-jex/src/main/java/io/avaje/jex/http/package-info.java b/avaje-jex/src/main/java/io/avaje/jex/http/package-info.java new file mode 100644 index 00000000..714cc482 --- /dev/null +++ b/avaje-jex/src/main/java/io/avaje/jex/http/package-info.java @@ -0,0 +1,2 @@ +/** Http Exceptions */ +package io.avaje.jex.http; diff --git a/avaje-jex/src/main/java/io/avaje/jex/security/package-info.java b/avaje-jex/src/main/java/io/avaje/jex/security/package-info.java new file mode 100644 index 00000000..bf145990 --- /dev/null +++ b/avaje-jex/src/main/java/io/avaje/jex/security/package-info.java @@ -0,0 +1,2 @@ +/** Security Classes */ +package io.avaje.jex.security; diff --git a/avaje-jex/src/main/java/io/avaje/jex/spi/package-info.java b/avaje-jex/src/main/java/io/avaje/jex/spi/package-info.java index 9a38d0bc..9656b44c 100644 --- a/avaje-jex/src/main/java/io/avaje/jex/spi/package-info.java +++ b/avaje-jex/src/main/java/io/avaje/jex/spi/package-info.java @@ -1,2 +1,6 @@ -/** SPI extension interfaces */ +/** + * SPI extension interfaces + * + * @see {@link io.avaje.jex.spi.JexExtension} + */ package io.avaje.jex.spi; diff --git a/avaje-jex/src/main/java/module-info.java b/avaje-jex/src/main/java/module-info.java index 4ee418a8..a688ce9f 100644 --- a/avaje-jex/src/main/java/module-info.java +++ b/avaje-jex/src/main/java/module-info.java @@ -1,5 +1,23 @@ import io.avaje.jex.spi.JexExtension; +/** + * Defines the Jex HTTP server API, for running a minimal HTTP server. + * + *
{@code
+ * final Jex.Server app = Jex.create()
+ *   .routing(routing -> routing
+ *     .get("/", ctx -> ctx.text("hello world"))
+ *     .get("/one", ctx -> ctx.text("one"))
+ *   .port(8080)
+ *   .start();
+ *
+ * app.shutdown();
+ *
+ * }
+ * + * @uses JexExtension + * + */ module io.avaje.jex { exports io.avaje.jex;