Skip to content

Commit c704bee

Browse files
github-actionsSentryMan
github-actions
authored andcommitted
Google Java Format
1 parent effa280 commit c704bee

File tree

84 files changed

+886
-905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+886
-905
lines changed

avaje-jex-freemarker/src/main/java/io/avaje/jex/render/freemarker/FreeMarkerRender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private Configuration defaultConfiguration() {
3434

3535
@Override
3636
public String[] defaultExtensions() {
37-
return new String[]{"ftl"};
37+
return new String[] {"ftl"};
3838
}
3939

4040
@Override

avaje-jex-freemarker/src/main/java/module-info.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
import io.avaje.jex.spi.JexExtension;
33

44
module io.avaje.jex.freemarker {
5-
65
requires transitive io.avaje.jex;
76
requires transitive freemarker;
87
requires java.net.http;
9-
108
requires static io.avaje.spi;
119

12-
provides JexExtension with FreeMarkerRender;
10+
provides JexExtension with
11+
FreeMarkerRender;
1312
}

avaje-jex-freemarker/src/test/java/io/avaje/jex/render/freemarker/FreeMarkerRenderTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ class FreeMarkerRenderTest {
1818

1919
static TestPair init() {
2020
final List<Routing.HttpService> services = List.of(new NoModel(), new WithModel());
21-
var app = Jex.create()
22-
.routing(services)
23-
.register(new FreeMarkerRender(), "ftl");
21+
var app = Jex.create().routing(services).register(new FreeMarkerRender(), "ftl");
2422
return TestPair.create(app);
2523
}
2624

avaje-jex-freemarker/src/test/java/io/avaje/jex/render/freemarker/FreeMarkerServiceLoaderTest.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ class FreeMarkerServiceLoaderTest {
1515
static TestPair pair = init();
1616

1717
static TestPair init() {
18-
var app = Jex.create()
19-
.routing(routing -> routing
20-
.get("/noModel", ctx -> ctx.render("one.ftl"))
21-
.get("/withModel", ctx -> ctx.render("two.ftl", Map.of("message", "hello")))
22-
);
23-
// not explicitly registered so auto registered via service loader
18+
var app =
19+
Jex.create()
20+
.routing(
21+
routing ->
22+
routing
23+
.get("/noModel", ctx -> ctx.render("one.ftl"))
24+
.get(
25+
"/withModel",
26+
ctx -> ctx.render("two.ftl", Map.of("message", "hello"))));
27+
// not explicitly registered so auto registered via service loader
2428
return TestPair.create(app);
2529
}
2630

avaje-jex-htmx/src/main/java/io/avaje/jex/htmx/DHxHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public void handle(Context ctx) throws Exception {
3030
}
3131

3232
private boolean matched(Context ctx) {
33-
if ((target != null && notMatched(ctx.header(HX_TARGET), target)) || (trigger != null && notMatched(ctx.header(HX_TRIGGER), trigger))) {
33+
if ((target != null && notMatched(ctx.header(HX_TARGET), target))
34+
|| (trigger != null && notMatched(ctx.header(HX_TRIGGER), trigger))) {
3435
return false;
3536
}
3637
return triggerName == null || !notMatched(ctx.header(HX_TRIGGER_NAME), triggerName);
@@ -39,5 +40,4 @@ private boolean matched(Context ctx) {
3940
private boolean notMatched(String header, String matchValue) {
4041
return header == null || !matchValue.equals(header);
4142
}
42-
4343
}

avaje-jex-htmx/src/main/java/io/avaje/jex/htmx/HxHandler.java

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,30 @@
44

55
/**
66
* Wrap a Handler with filtering for Htmx specific headers.
7-
* <p>
8-
* The underlying Handler will not be invoked unless the request
9-
* is a Htmx request and matches the required attributes.
7+
*
8+
* <p>The underlying Handler will not be invoked unless the request is a Htmx request and matches
9+
* the required attributes.
1010
*/
1111
public interface HxHandler {
1212

13-
/**
14-
* Create a builder that wraps the underlying handler with Htmx
15-
* specific attribute matching.
16-
*/
13+
/** Create a builder that wraps the underlying handler with Htmx specific attribute matching. */
1714
static Builder builder(ExchangeHandler delegate) {
1815
return new DHxHandlerBuilder(delegate);
1916
}
2017

21-
/**
22-
* Build the Htmx request handler.
23-
*/
18+
/** Build the Htmx request handler. */
2419
interface Builder {
2520

26-
/**
27-
* Match on the given target.
28-
*/
21+
/** Match on the given target. */
2922
Builder target(String target);
3023

31-
/**
32-
* Match on the given trigger.
33-
*/
24+
/** Match on the given trigger. */
3425
Builder trigger(String trigger);
3526

36-
/**
37-
* Match on the given trigger name.
38-
*/
27+
/** Match on the given trigger name. */
3928
Builder triggerName(String triggerName);
4029

41-
/**
42-
* Build and return the Handler.
43-
*/
30+
/** Build and return the Handler. */
4431
ExchangeHandler build();
4532
}
4633
}

avaje-jex-htmx/src/main/java/io/avaje/jex/htmx/HxHeaders.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,32 @@ public interface HxHeaders {
3434
* @see <a href="https://htmx.org/reference/#request_headers">HX-Prompt</a>
3535
*/
3636
String HX_PROMPT = "HX-Prompt";
37+
3738
/**
3839
* Only present and {@code true} if the request is issued by htmx.
3940
*
4041
* @see <a href="https://htmx.org/reference/#request_headers">HX-Request</a>
4142
*/
4243
String HX_REQUEST = "HX-Request";
44+
4345
/**
4446
* The {@code id} of the target element if it exists.
4547
*
4648
* @see <a href="https://htmx.org/reference/#request_headers">HX-Target</a>
4749
*/
4850
String HX_TARGET = "HX-Target";
51+
4952
/**
5053
* The {@code name} of the triggered element if it exists
5154
*
5255
* @see <a href="https://htmx.org/reference/#request_headers">HX-Trigger-Name</a>
5356
*/
5457
String HX_TRIGGER_NAME = "HX-Trigger-Name";
58+
5559
/**
5660
* The {@code id} of the triggered element if it exists.
5761
*
5862
* @see <a href="https://htmx.org/reference/#request_headers">HX-Trigger</a>
5963
*/
6064
String HX_TRIGGER = "HX-Trigger";
61-
6265
}

avaje-jex-htmx/src/main/java/io/avaje/jex/htmx/HxReq.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
import io.avaje.htmx.api.HtmxRequest;
44
import io.avaje.jex.http.Context;
55

6-
/**
7-
* Obtain the HtmxRequest for the given Jex Context.
8-
*/
6+
/** Obtain the HtmxRequest for the given Jex Context. */
97
public final class HxReq {
108

11-
/**
12-
* Create given the server request.
13-
*/
9+
/** Create given the server request. */
1410
public static HtmxRequest of(Context ctx) {
1511
String header = ctx.header(HxHeaders.HX_REQUEST);
1612
if (header == null) {

avaje-jex-htmx/src/main/java/io/avaje/jex/htmx/TemplateContentCache.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,18 @@
22

33
import io.avaje.jex.http.Context;
44

5-
/**
6-
* Defines caching of template content.
7-
*/
5+
/** Defines caching of template content. */
86
public interface TemplateContentCache {
97

10-
/**
11-
* Return the key given the request.
12-
*/
8+
/** Return the key given the request. */
139
String key(Context req);
1410

15-
/**
16-
* Return the key given the request with form parameters.
17-
*/
11+
/** Return the key given the request with form parameters. */
1812
String key(Context req, Object formParams);
1913

20-
/**
21-
* Return the content given the key.
22-
*/
14+
/** Return the content given the key. */
2315
String content(String key);
2416

25-
/**
26-
* Put the content into the cache.
27-
*/
17+
/** Put the content into the cache. */
2818
void contentPut(String key, String content);
29-
3019
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
package io.avaje.jex.htmx;
22

3-
/**
4-
* Template render API.
5-
*/
3+
/** Template render API. */
64
public interface TemplateRender {
75

8-
/**
9-
* Render the given template view model to the server response.
10-
*/
6+
/** Render the given template view model to the server response. */
117
String render(Object viewModel);
128
}

avaje-jex-htmx/src/main/java/module-info.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module io.avaje.jex.htmx {
2-
32
requires transitive io.avaje.jex;
43
requires transitive io.avaje.htmx.api;
54
requires transitive jdk.httpserver;

avaje-jex-mustache/src/main/java/io/avaje/jex/render/mustache/MustacheRender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public MustacheRender() {
2727

2828
@Override
2929
public String[] defaultExtensions() {
30-
return new String[]{"mustache"};
30+
return new String[] {"mustache"};
3131
}
3232

3333
@Override
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module io.avaje.jex.mustache {
2-
32
requires transitive io.avaje.jex;
43
requires transitive com.github.mustachejava;
54
requires java.net.http;
6-
75
requires static io.avaje.spi;
86

9-
provides io.avaje.jex.spi.JexExtension with io.avaje.jex.render.mustache.MustacheRender;
7+
provides io.avaje.jex.spi.JexExtension with
8+
io.avaje.jex.render.mustache.MustacheRender;
109
}

avaje-jex-mustache/src/test/java/io/avaje/jex/render/mustache/MustacheRenderTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ class MustacheRenderTest {
1616
static TestPair pair1 = init(false);
1717

1818
static TestPair init(boolean explicit) {
19-
var app = Jex.create()
20-
.routing(routing -> routing
21-
.get("/noModel", ctx -> ctx.render("one.mustache"))
22-
.get("/withModel", ctx -> ctx.render("two.mustache", Map.of("message", "hello")))
23-
);
19+
var app =
20+
Jex.create()
21+
.routing(
22+
routing ->
23+
routing
24+
.get("/noModel", ctx -> ctx.render("one.mustache"))
25+
.get(
26+
"/withModel",
27+
ctx -> ctx.render("two.mustache", Map.of("message", "hello"))));
2428
if (explicit) {
2529
app.register(new MustacheRender(), "mustache");
2630
}

avaje-jex-static-content/src/main/java/io/avaje/jex/staticcontent/StaticContent.java

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99

1010
/**
1111
* Static content resource handler.
12-
* <pre>{@code
1312
*
14-
* var staticContent = StaticContent.createFile("src/test/resources/public")
15-
* .directoryIndex("index.html")
16-
* .preCompress()
17-
* .build()
13+
* <pre>{@code
14+
* var staticContent = StaticContent.createFile("src/test/resources/public")
15+
* .directoryIndex("index.html")
16+
* .preCompress()
17+
* .build()
1818
*
19-
* Jex.create()
20-
* .plugin(staticContent)
21-
* .port(8080)
22-
* .start();
19+
* Jex.create()
20+
* .plugin(staticContent)
21+
* .port(8080)
22+
* .start();
2323
*
2424
* }</pre>
2525
*/
26-
public sealed interface StaticContent extends JexPlugin
27-
permits StaticResourceHandlerBuilder {
26+
public sealed interface StaticContent extends JexPlugin permits StaticResourceHandlerBuilder {
2827

2928
/**
3029
* Create and return a new static content class path configuration.
@@ -36,8 +35,8 @@ static Builder createCP(String resourceRoot) {
3635
}
3736

3837
/**
39-
* Create and return a new static content class path configuration with the
40-
* `/public` directory as the root.
38+
* Create and return a new static content class path configuration with the `/public` directory as
39+
* the root.
4140
*/
4241
static Builder createCP() {
4342
return StaticResourceHandlerBuilder.builder("/public/");
@@ -52,11 +51,8 @@ static Builder createFile(String resourceRoot) {
5251
return StaticResourceHandlerBuilder.builder(resourceRoot).file();
5352
}
5453

55-
/**
56-
* Builder for StaticContent.
57-
*/
58-
sealed interface Builder
59-
permits StaticResourceHandlerBuilder {
54+
/** Builder for StaticContent. */
55+
sealed interface Builder permits StaticResourceHandlerBuilder {
6056

6157
/**
6258
* Sets the HTTP route for the static resource handler.
@@ -97,17 +93,17 @@ sealed interface Builder
9793
* Adds a new MIME type mapping to the configuration. (Default: uses {@link
9894
* URLConnection#getFileNameMap()}
9995
*
100-
* @param ext the file extension (e.g., "html", "css", "js")
96+
* @param ext the file extension (e.g., "html", "css", "js")
10197
* @param mimeType the corresponding MIME type (e.g., "text/html", "text/css",
102-
* "application/javascript")
98+
* "application/javascript")
10399
* @return the updated configuration
104100
*/
105101
Builder putMimeTypeMapping(String ext, String mimeType);
106102

107103
/**
108104
* Adds a new response header to the configuration.
109105
*
110-
* @param key the header name
106+
* @param key the header name
111107
* @param value the header value
112108
* @return the updated configuration
113109
*/
@@ -121,9 +117,7 @@ sealed interface Builder
121117
*/
122118
Builder skipFilePredicate(Predicate<Context> skipFilePredicate);
123119

124-
/**
125-
* Build and return the StaticContent.
126-
*/
120+
/** Build and return the StaticContent. */
127121
StaticContent build();
128122
}
129123
}

avaje-jex-static-content/src/main/java/module-info.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/**
2-
* Defines the Static Content API for serving static resources with Jex - see {@link io.avaje.jex.staticcontent.StaticContent}.
2+
* Defines the Static Content API for serving static resources with Jex - see {@link
3+
* io.avaje.jex.staticcontent.StaticContent}.
34
*
45
* <pre>{@code
56
* var staticContent = StaticContentService.createCP("/public").httpPath("/").directoryIndex("index.html");
@@ -13,9 +14,7 @@
1314
* }</pre>
1415
*/
1516
module io.avaje.jex.staticcontent {
16-
1717
exports io.avaje.jex.staticcontent;
1818

1919
requires transitive io.avaje.jex;
20-
2120
}

0 commit comments

Comments
 (0)