Skip to content

Commit 629092b

Browse files
committed
palantir java format
1 parent 8b4cb6f commit 629092b

File tree

97 files changed

+1137
-1543
lines changed

Some content is hidden

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

97 files changed

+1137
-1543
lines changed

.github/workflows/spotless.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Spotless Check
22
on: [push, workflow_dispatch]
33

44
concurrency:
5-
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
65
cancel-in-progress: true
76
jobs:
87
check:
@@ -19,4 +18,4 @@ jobs:
1918
java-version: 21
2019
distribution: 'zulu'
2120
- name: Run Spotless Check
22-
run: mvn --batch-mode --no-transfer-progress spotless:check ${{ inputs.maven-args }}
21+
run: mvn --batch-mode --no-transfer-progress spotless:check

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package io.avaje.jex.render.freemarker;
22

3-
import java.io.IOException;
4-
import java.io.StringWriter;
5-
import java.io.UncheckedIOException;
6-
import java.util.Map;
7-
83
import freemarker.template.Configuration;
94
import freemarker.template.Template;
105
import freemarker.template.TemplateException;
116
import freemarker.template.Version;
127
import io.avaje.jex.http.Context;
138
import io.avaje.jex.spi.TemplateRender;
149
import io.avaje.spi.ServiceProvider;
10+
import java.io.IOException;
11+
import java.io.StringWriter;
12+
import java.io.UncheckedIOException;
13+
import java.util.Map;
1514

1615
@ServiceProvider
1716
public class FreeMarkerRender implements TemplateRender {

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package io.avaje.jex.render.freemarker;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import io.avaje.jex.Jex;
46
import io.avaje.jex.Routing;
57
import io.avaje.jex.test.TestPair;
6-
import org.junit.jupiter.api.AfterAll;
7-
import org.junit.jupiter.api.Test;
8-
98
import java.net.http.HttpResponse;
109
import java.util.List;
1110
import java.util.Map;
12-
13-
import static org.assertj.core.api.Assertions.assertThat;
11+
import org.junit.jupiter.api.AfterAll;
12+
import org.junit.jupiter.api.Test;
1413

1514
class FreeMarkerRenderTest {
1615

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
package io.avaje.jex.render.freemarker;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import io.avaje.jex.Jex;
46
import io.avaje.jex.test.TestPair;
5-
import org.junit.jupiter.api.AfterAll;
6-
import org.junit.jupiter.api.Test;
7-
87
import java.net.http.HttpResponse;
98
import java.util.Map;
10-
11-
import static org.assertj.core.api.Assertions.assertThat;
9+
import org.junit.jupiter.api.AfterAll;
10+
import org.junit.jupiter.api.Test;
1211

1312
class FreeMarkerServiceLoaderTest {
1413

1514
static TestPair pair = init();
1615

1716
static TestPair init() {
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"))));
17+
var app = Jex.create().routing(routing -> routing.get("/noModel", ctx -> ctx.render("one.ftl"))
18+
.get("/withModel", ctx -> ctx.render("two.ftl", Map.of("message", "hello"))));
2719
// not explicitly registered so auto registered via service loader
2820
return TestPair.create(app);
2921
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
/**
66
* Wrap a Handler with filtering for Htmx specific headers.
77
*
8-
* <p>The underlying Handler will not be invoked unless the request is a Htmx request and matches
9-
* the required attributes.
8+
* <p>The underlying Handler will not be invoked unless the request is a Htmx request and matches the required
9+
* attributes.
1010
*/
1111
public interface HxHandler {
1212

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import com.github.mustachejava.DefaultMustacheFactory;
44
import com.github.mustachejava.MustacheFactory;
5-
65
import io.avaje.jex.http.Context;
76
import io.avaje.jex.spi.TemplateRender;
87
import io.avaje.spi.ServiceProvider;
9-
108
import java.io.IOException;
119
import java.io.StringWriter;
1210
import java.io.UncheckedIOException;

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,22 @@
11
package io.avaje.jex.render.mustache;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
4+
35
import io.avaje.jex.Jex;
46
import io.avaje.jex.test.TestPair;
5-
import org.junit.jupiter.api.AfterAll;
6-
import org.junit.jupiter.api.Test;
7-
87
import java.net.http.HttpResponse;
98
import java.util.Map;
10-
11-
import static org.assertj.core.api.Assertions.assertThat;
9+
import org.junit.jupiter.api.AfterAll;
10+
import org.junit.jupiter.api.Test;
1211

1312
class MustacheRenderTest {
1413

1514
static TestPair pair0 = init(true);
1615
static TestPair pair1 = init(false);
1716

1817
static TestPair init(boolean explicit) {
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"))));
18+
var app = Jex.create().routing(routing -> routing.get("/noModel", ctx -> ctx.render("one.mustache"))
19+
.get("/withModel", ctx -> ctx.render("two.mustache", Map.of("message", "hello"))));
2820
if (explicit) {
2921
app.register(new MustacheRender(), "mustache");
3022
}

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package io.avaje.jex.staticcontent;
22

3+
import com.sun.net.httpserver.HttpExchange;
4+
import io.avaje.jex.compression.CompressedOutputStream;
5+
import io.avaje.jex.compression.CompressionConfig;
6+
import io.avaje.jex.http.BadRequestException;
7+
import io.avaje.jex.http.Context;
8+
import io.avaje.jex.http.ExchangeHandler;
9+
import io.avaje.jex.http.NotFoundException;
310
import java.io.ByteArrayOutputStream;
411
import java.io.IOException;
512
import java.io.InputStream;
@@ -10,15 +17,6 @@
1017
import java.util.concurrent.ConcurrentHashMap;
1118
import java.util.function.Predicate;
1219

13-
import com.sun.net.httpserver.HttpExchange;
14-
15-
import io.avaje.jex.compression.CompressedOutputStream;
16-
import io.avaje.jex.compression.CompressionConfig;
17-
import io.avaje.jex.http.BadRequestException;
18-
import io.avaje.jex.http.Context;
19-
import io.avaje.jex.http.ExchangeHandler;
20-
import io.avaje.jex.http.NotFoundException;
21-
2220
abstract sealed class AbstractStaticHandler implements ExchangeHandler
2321
permits StaticFileHandler, StaticClassResourceHandler {
2422

@@ -72,12 +70,10 @@ protected String getExt(String path) {
7270

7371
protected String lookupMime(String path) {
7472
var lower = path.toLowerCase();
75-
return Objects.requireNonNullElseGet(
76-
MIME_MAP.getContentTypeFor(path),
77-
() -> {
78-
String ext = getExt(lower);
79-
return mimeTypes.getOrDefault(ext, "application/octet-stream");
80-
});
73+
return Objects.requireNonNullElseGet(MIME_MAP.getContentTypeFor(path), () -> {
74+
String ext = getExt(lower);
75+
return mimeTypes.getOrDefault(ext, "application/octet-stream");
76+
});
8177
}
8278

8379
protected boolean isCached(final String path) {

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
/**
66
* Loading resources from the classpath or module path.
77
*
8-
* <p>When not specified Avaje Jex provides a default implementation that looks to find resources
9-
* using the class loader associated with the ClassResourceLoader.
8+
* <p>When not specified Avaje Jex provides a default implementation that looks to find resources using the class loader
9+
* associated with the ClassResourceLoader.
1010
*
11-
* <p>As a fallback, {@link ClassLoader#getSystemResourceAsStream(String)} is used if the loader
12-
* returns null.
11+
* <p>As a fallback, {@link ClassLoader#getSystemResourceAsStream(String)} is used if the loader returns null.
1312
*/
1413
public interface ClassResourceLoader {
1514

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ public URL loadResource(String resourcePath) {
2121
var url = clazz.getResource(resourcePath);
2222
if (url == null) {
2323
// search the module path for top level resource
24-
url =
25-
Optional.ofNullable(ClassLoader.getSystemResource(resourcePath))
26-
.orElseGet(
27-
() -> Thread.currentThread().getContextClassLoader().getResource(resourcePath));
24+
url = Optional.ofNullable(ClassLoader.getSystemResource(resourcePath))
25+
.orElseGet(
26+
() -> Thread.currentThread().getContextClassLoader().getResource(resourcePath));
2827
}
2928
return Objects.requireNonNull(url, "Unable to locate resource: " + resourcePath);
3029
}

0 commit comments

Comments
 (0)