Cheatsheet: JavaPoet

Placeholders

$L

addStatement("$N.toString()", fieldName)
// output
name.toString();

addStatement("String initialValue = $S", initialValue)
// output
String initialValue = "EXCHANGE_RATE";

addStatement("$T a = $S", String.class, "")
// output
String a = "";

Control flow