Configure checkstyle for method chain?

Our project contains many statements in a method in which a fluent style:

    int totalCount = ((Number) em
        .createQuery("select count(up) from UserPermission up where " +
            "up.database.id = :dbId and " +
            "up.user.id <> :currentUserId ")
        .setParameter("dbId", cmd.getDatabaseId())
        .setParameter("currentUserId", currentUser.getId())
        .getSingleResult())
        .intValue();

I have a checkstyle, mostly configured to match our existing code style, but now it doesn't work in these snippets, preferring instead:

    int totalCount = ((Number) em
        .createQuery("select count(up) from UserPermission up where " +
            "up.database.id = :dbId and " +
            "up.user.id <> :currentUserId ")
            .setParameter("dbId", cmd.getDatabaseId())
                .setParameter("currentUserId", currentUser.getId())
                    .getSingleResult())
                        .intValue();

Which is completely inappropriate. Anyway, to set up a checkstyle to accept a method chain style? Is there an alternative tool that I can run from maven to provide such indentation?

+5
source share
2 answers

Eclipse, Format Source. , . . . Eclipse, .

, , . . , -

public static void myMethod( int value, String value2, String value3)

, .

, , , -.

-1

intellij, , "align when multiline" " ", , .

-2

All Articles