Skip to content

Commit

Permalink
Tidy core - final classes and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
rbygrave committed Nov 26, 2024
1 parent 0736537 commit 081e276
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ public final class CoreServiceLoader {

CoreServiceLoader() {
JsonService spiJsonService = null;

for (var spi : ServiceLoader.load(JexExtension.class)) {

switch (spi) {
case JsonService s -> spiJsonService = s;
case TemplateRender r -> renders.add(r);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static SpiServiceManager create(Jex jex) {
return new Builder(jex).build();
}

CoreServiceManager(JsonService jsonService, ExceptionManager manager, TemplateManager templateManager) {
CoreServiceManager(JsonService jsonService, ExceptionManager manager, TemplateManager templateManager) {
this.jsonService = jsonService;
this.exceptionHandler = manager;
this.templateManager = templateManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ private void unhandledException(SpiContext ctx, Exception e) {
}

private void defaultHandling(SpiContext ctx, HttpResponseException exception) {

ctx.status(exception.getStatus());
if (exception.getStatus() == ErrorCode.REDIRECT.status()) {
ctx.performRedirect();
Expand Down
2 changes: 1 addition & 1 deletion avaje-jex/src/main/java/io/avaje/jex/core/HeaderKeys.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.avaje.jex.core;

public class HeaderKeys {
public final class HeaderKeys {

private HeaderKeys() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Health plugin with liveness and readiness support based on
* the application lifecycle support.
*/
public class HealthPlugin implements JexPlugin {
public final class HealthPlugin implements JexPlugin {

private AppLifecycle lifecycle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class TemplateManager {
*/
public void register(Map<String, TemplateRender> source) {
map.putAll(source);
map.values().stream().forEach(templateRender -> renderTypes.add(templateRender.getClass()));
map.values().forEach(templateRender -> renderTypes.add(templateRender.getClass()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import io.avaje.jex.spi.JsonService;

public class JacksonJsonService implements JsonService {
public final class JacksonJsonService implements JsonService {

private final ObjectMapper mapper;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.avaje.jex.core.json;

import io.avaje.jex.spi.JsonService;
import io.avaje.jex.spi.SpiContext;
import io.avaje.jsonb.JsonType;
import io.avaje.jsonb.JsonWriter;
import io.avaje.jsonb.Jsonb;
Expand All @@ -13,7 +12,7 @@
/**
* Provides JsonService using avaje-jsonb.
*/
public class JsonbJsonService implements JsonService {
public final class JsonbJsonService implements JsonService {

private final Jsonb jsonb;

Expand All @@ -33,13 +32,11 @@ public JsonbJsonService(Jsonb jsonb) {

@Override
public <T> T jsonRead(Class<T> clazz, InputStream is) {

return jsonb.type(clazz).fromJson(is);
}

@Override
public void jsonWrite(Object bean, OutputStream os) {

jsonb.toJson(bean, os);
}

Expand Down

0 comments on commit 081e276

Please sign in to comment.