com.puppycrawl.tools.checkstyle.checks.blocks

Class LeftCurlyOption

public final class LeftCurlyOption extends AbstractOption

Represents the options for placing the left curly brace '{'.

Version: 1

Author: Oliver Burn

Field Summary
static LeftCurlyOptionEOL
Represents the policy for placing the brace at the end of line.
static LeftCurlyOptionNL
Represents the policy that the brace must always be on a new line.
static LeftCurlyOptionNLOW
Represents the policy that if the brace will fit on the first line of the statement, taking into account maximum line length, then apply EOL rule.
Method Summary
protected MapgetStrToOpt()
{@inheritDoc}

Field Detail

EOL

public static final LeftCurlyOption EOL
Represents the policy for placing the brace at the end of line. For example:
 if (condition) {
     ...
 

NL

public static final LeftCurlyOption NL
Represents the policy that the brace must always be on a new line. For example:
 if (condition)
 {
     ...
 

NLOW

public static final LeftCurlyOption NLOW
Represents the policy that if the brace will fit on the first line of the statement, taking into account maximum line length, then apply EOL rule. Otherwise apply the NL rule. NLOW is a mnemonic for "new line on wrap".

For the example above Checkstyle will enforce:

 if (condition) {
     ...
 
But for a statement spanning multiple lines, Checkstyle will enforce:
 if (condition1 && condition2 &&
     condition3 && condition4)
 {
     ...
 

Method Detail

getStrToOpt

protected Map getStrToOpt()
{@inheritDoc}