Code formatting for long boolean return statement

I'm using the "Equals and HashCode Deluxe Generator" plugin https://github.com/mjedynak/EqualsHashCodeDeluxeGenerator to generate Java 7 style equals().

The resulting return statement is all on one line and I'd like to reformat this with line breaks but I can't find any options in the Code Style settings to reformat a long return statement, is this possible?

@Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        final Account other = (Account) obj;
        return Objects.equals(this.id, other.id) && Objects.equals(this.accountType, other.accountType) && Objects.equals(this.currency, other.currency) && Objects.equals(this.description, other.description) && Objects.equals(this.entries, other.entries) && Objects.equals(this.company, other.company);
    }

3 comments

Hi Phill,

Try to set 'Project Settings | Code Style | Java | Wrapping and Braces | Binary expressions' to 'Wrap if long'. Optionally you can also check 'Binary expressions | Align when multiline' box.

Denis

0

That's the one! works thanks.

0

Please sign in to leave a comment.