I have to write code at another style. I wondering to how to configure intellij for this purpose?
It is before code looking:
@Override
public void generateTestObjectsInDb(Object... objects) {
try {
for (Object obj : objects) {
DataBaseObjectService.createObjectInDB(obj);
}
} catch (Exception e) {
Logger.fatal("Error occured while generating data in product Database.", e);
}
}
And here is how it should looks:
@Override
public void generateTestObjectsInDb(Object... objects)
{
try
{
for (Object obj : objects)
{
DataBaseObjectService.createObjectInDB(obj);
}
}
catch (Exception e)
{
Logger.fatal("Error occured while generating data in product Database.", e);
}
}
How to chive this new code looking after using statndard key bindings Ctrl + Alt + L ?
You can change this in settings
File
=> Settings
=> Code Style
=> Java
=> Wrapping and Braces
=> Braces Placement
.
Code Style is under Editor.
File > Settings... > Editor > Code Style > Java > Wrapping and Braces > Braces Placement > change "End of line" to "Next line" for "In class declaration", "In method declaration" and "Other" > OK
On the right side, you will see a live preview.
Apply the new formatting
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.