Skip to content

Commit a8d0aa0

Browse files
committed
make generation easier to debug
1 parent 7b349ea commit a8d0aa0

File tree

1 file changed

+11
-0
lines changed
  • inject-generator/src/main/java/io/avaje/inject/generator

1 file changed

+11
-0
lines changed

inject-generator/src/main/java/io/avaje/inject/generator/Append.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
final class Append {
1111

1212
private final Writer writer;
13+
private final StringBuilder stringBuilder = new StringBuilder();
1314
private int nameIndex;
1415
private boolean comma;
1516
private String extraIndent;
@@ -27,8 +28,10 @@ Append indent(String content) {
2728
try {
2829
if (extraIndent != null) {
2930
writer.append(extraIndent);
31+
stringBuilder.append(extraIndent);
3032
}
3133
writer.append(content);
34+
stringBuilder.append(content);
3235
return this;
3336
} catch (IOException e) {
3437
throw new UncheckedIOException(e);
@@ -38,6 +41,7 @@ Append indent(String content) {
3841
Append append(String content) {
3942
try {
4043
writer.append(content);
44+
stringBuilder.append(content);
4145
return this;
4246
} catch (IOException e) {
4347
throw new UncheckedIOException(e);
@@ -56,6 +60,7 @@ void close() {
5660
Append eol() {
5761
try {
5862
writer.append("\n");
63+
stringBuilder.append("\n");
5964
return this;
6065
} catch (IOException e) {
6166
throw new UncheckedIOException(e);
@@ -86,4 +91,10 @@ void commaAppend(String name) {
8691
}
8792
append(name);
8893
}
94+
95+
96+
@Override
97+
public String toString() {
98+
return stringBuilder.toString();
99+
}
89100
}

0 commit comments

Comments
 (0)