Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
*/
final class Append {

private static final boolean debug = Boolean.getBoolean("append.debug");

private final Writer writer;
private final StringBuilder stringBuilder = new StringBuilder();
private int nameIndex;
private boolean comma;
private String extraIndent;
Expand All @@ -27,8 +30,14 @@ Append indent(String content) {
try {
if (extraIndent != null) {
writer.append(extraIndent);
if (debug) {
stringBuilder.append(extraIndent);
}
}
writer.append(content);
if (debug) {
stringBuilder.append(content);
}
return this;
} catch (IOException e) {
throw new UncheckedIOException(e);
Expand All @@ -38,6 +47,9 @@ Append indent(String content) {
Append append(String content) {
try {
writer.append(content);
if (debug) {
stringBuilder.append(content);
}
return this;
} catch (IOException e) {
throw new UncheckedIOException(e);
Expand All @@ -56,6 +68,9 @@ void close() {
Append eol() {
try {
writer.append("\n");
if (debug) {
stringBuilder.append("\n");
}
return this;
} catch (IOException e) {
throw new UncheckedIOException(e);
Expand Down Expand Up @@ -86,4 +101,10 @@ void commaAppend(String name) {
}
append(name);
}


@Override
public String toString() {
return stringBuilder.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ void deleteGeneratedFiles() {
//@Disabled
@Test
void testGeneration() throws Exception {

System.setProperty("append.debug", "true");

final String source =
Paths.get("src/test/java/io/avaje/inject/generator/models/valid")
.toAbsolutePath()
Expand Down
Loading