Skip to content

Commit 5ef674a

Browse files
committed
#56 - Generate with $Route suffix rather than $route suffix
1 parent 9bab02b commit 5ef674a

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class WidgetController(private val hello: HelloComponent) {
4646

4747
## Generated source
4848

49-
The annotation processor will generate a `$route` for the controller like below.
49+
The annotation processor will generate a `$Route` for the controller like below.
5050

5151
Note that this class implements the WebRoutes interface, which means we can
5252
get all the WebRoutes and register them with Javalin using.
@@ -76,7 +76,7 @@ fun main(args: Array<String>) {
7676

7777
```
7878

79-
### The generated WidgetController$route.java is:
79+
### The generated WidgetController$Route.java is:
8080

8181

8282
```java
@@ -91,7 +91,7 @@ import org.example.hello.WidgetController;
9191

9292
@Generated("io.avaje.javalin-generator")
9393
@Singleton
94-
public class WidgetController$route implements WebRoutes {
94+
public class WidgetController$Route implements WebRoutes {
9595

9696
private final WidgetController controller;
9797

http-generator-core/src/main/java/io/avaje/http/generator/core/BaseControllerWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public abstract class BaseControllerWriter {
2020
protected Append writer;
2121

2222
protected BaseControllerWriter(ControllerReader reader, ProcessingContext ctx) throws IOException {
23-
this(reader, ctx, "$route");
23+
this(reader, ctx, "$Route");
2424
}
2525

2626
protected BaseControllerWriter(ControllerReader reader, ProcessingContext ctx, String suffix) throws IOException {
2727
this.reader = reader;
2828
this.ctx = ctx;
29-
this.router = "$route".equals(suffix);
29+
this.router = "$Route".equals(suffix);
3030
TypeElement origin = reader.getBeanType();
3131
this.originName = origin.getQualifiedName().toString();
3232
this.shortName = origin.getSimpleName().toString();

http-generator-core/src/main/java/io/avaje/http/generator/core/BaseProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private void writeControllerAdapter(Element controller) {
9393
writeControllerAdapter(ctx, reader);
9494
} catch (Throwable e) {
9595
e.printStackTrace();
96-
ctx.logError(reader.getBeanType(), "Failed to write $route class " + e);
96+
ctx.logError(reader.getBeanType(), "Failed to write $Route class " + e);
9797
}
9898
}
9999
}

http-generator-helidon/src/main/java/io/avaje/http/generator/helidon/ControllerWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void writeRoutes(List<ControllerMethodWriter> methods) {
6464
private void writeClassStart() {
6565
writer.append(AT_GENERATED).eol();
6666
writer.append("@Singleton").eol();
67-
writer.append("public class ").append(shortName).append("$route implements Service {").eol().eol();
67+
writer.append("public class ").append(shortName).append("$Route implements Service {").eol().eol();
6868

6969
String controllerName = "controller";
7070
String controllerType = shortName;
@@ -78,7 +78,7 @@ private void writeClassStart() {
7878
}
7979
writer.eol();
8080

81-
writer.append(" public %s$route(%s %s", shortName, controllerType, controllerName);
81+
writer.append(" public %s$Route(%s %s", shortName, controllerType, controllerName);
8282
if (reader.isIncludeValidator()) {
8383
writer.append(", Validator validator");
8484
}

http-generator-javalin/src/main/java/io/avaje/http/generator/javalin/ControllerWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private void writeForMethod(MethodReader method) {
4949
private void writeClassStart() {
5050
writer.append(AT_GENERATED).eol();
5151
writer.append("@Singleton").eol();
52-
writer.append("public class ").append(shortName).append("$route implements WebRoutes {").eol().eol();
52+
writer.append("public class ").append(shortName).append("$Route implements WebRoutes {").eol().eol();
5353

5454
String controllerName = "controller";
5555
String controllerType = shortName;
@@ -64,7 +64,7 @@ private void writeClassStart() {
6464
}
6565
writer.eol();
6666

67-
writer.append(" public %s$route(%s %s", shortName, controllerType, controllerName);
67+
writer.append(" public %s$Route(%s %s", shortName, controllerType, controllerName);
6868
if (reader.isIncludeValidator()) {
6969
writer.append(", Validator validator");
7070
}

http-generator-jex/src/main/java/io/avaje/http/generator/jex/ControllerWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private void writeForMethod(MethodReader method) {
5151
private void writeClassStart() {
5252
writer.append(AT_GENERATED).eol();
5353
writer.append("@Singleton").eol();
54-
writer.append("public class ").append(shortName).append("$route implements Routing.Service {").eol().eol();
54+
writer.append("public class ").append(shortName).append("$Route implements Routing.Service {").eol().eol();
5555

5656
String controllerName = "controller";
5757
String controllerType = shortName;
@@ -66,7 +66,7 @@ private void writeClassStart() {
6666
}
6767
writer.eol();
6868

69-
writer.append(" public %s$route(%s %s", shortName, controllerType, controllerName);
69+
writer.append(" public %s$Route(%s %s", shortName, controllerType, controllerName);
7070
if (reader.isIncludeValidator()) {
7171
writer.append(", Validator validator");
7272
}

http-generator-spark/src/main/java/io/avaje/http/generator/spark/ControllerWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private void writeForMethod(MethodReader method) {
4949
private void writeClassStart() {
5050
writer.append(AT_GENERATED).eol();
5151
writer.append("@Singleton").eol();
52-
writer.append("public class ").append(shortName).append("$route implements WebRoutes {").eol().eol();
52+
writer.append("public class ").append(shortName).append("$Route implements WebRoutes {").eol().eol();
5353

5454
String controllerName = "controller";
5555
String controllerType = shortName;
@@ -64,7 +64,7 @@ private void writeClassStart() {
6464
}
6565
writer.eol();
6666

67-
writer.append(" public %s$route(%s %s", shortName, controllerType, controllerName);
67+
writer.append(" public %s$Route(%s %s", shortName, controllerType, controllerName);
6868
if (reader.isIncludeValidator()) {
6969
writer.append(", Validator validator");
7070
}

0 commit comments

Comments
 (0)