Reputation: 18572
I have to write code in another style. Am I wondering 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 look:
@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 achive this new code looking after using statndard key bindings Ctrl + Alt + L?
Upvotes: 2
Views: 4291
Reputation: 56636
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
Upvotes: 0
Reputation: 140
You can change this in settings
File
=> Settings
=> Code Style
=> Java
=> Wrapping and Braces
=> Braces Placement
.
Upvotes: 5