在IntelliJ
中自动生成toString方法时,它将所有文本放在一行上。其中一些线很大 - 我怎样才能让Intellij在每个新变量之后将toString拆分成多行?
这就是我所拥有的:
@Override
public String toString() {
return "Address{" + " line1='" + line1 + '\'' + ", line2='" + line2 + '\'' + ", town='" + town + '\'' + ", county='" + county + '\'' + ", postcode='" + postcode + '\'' + ", country='" + country + '\'' + '}';
}
这就是我想要的:
@Override
public String toString() {
return "Address{"
+ " line1='" + line1 + '\''
+ ", line2='" + line2 + '\''
+ ", town='" + town + '\''
+ ", county='" + county + '\''
+ ", postcode='" + postcode + '\''
+ ", country='" + country + '\'' + '}';
}
我尝试过创建自定义模板,但似乎忽略了这一点。