public class SeparatorWrapCheck extends AbstractCheck
Checks line wrapping with separators.
option - Specify policy on how to wrap lines.
Default value is eol.
tokens - tokens to check
Default value is:
DOT,
COMMA.
Code example for comma and dot at the new line:
s
.isEmpty();
foo(i
,s);
To configure the check:
<module name="SeparatorWrap"/>
Code example for comma and dot at the previous line:
s.
isEmpty();
foo(i,
s);
Example for checking method reference at new line (good case and bad case):
Arrays.sort(stringArray, String:: // violation
compareToIgnoreCase);
Arrays.sort(stringArray, String
::compareToIgnoreCase); // good
To configure the check for METHOD_REF at new line:
<module name="SeparatorWrap"> <property name="tokens" value="METHOD_REF"/> <property name="option" value="nl"/> </module>
To configure the check for comma at the new line:
<module name="SeparatorWrap"> <property name="tokens" value="COMMA"/> <property name="option" value="nl"/> </module>
AutomaticBean.OutputStreamOptions| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MSG_LINE_NEW
A key is pointing to the warning message text in "messages.properties"
file.
|
static java.lang.String |
MSG_LINE_PREVIOUS
A key is pointing to the warning message text in "messages.properties"
file.
|
| Constructor and Description |
|---|
SeparatorWrapCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
setOption(java.lang.String optionStr)
Setter to specify policy on how to wrap lines.
|
void |
visitToken(DetailAST ast)
Called to process a token.
|
beginTree, clearMessages, destroy, finishTree, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic static final java.lang.String MSG_LINE_PREVIOUS
public static final java.lang.String MSG_LINE_NEW
public SeparatorWrapCheck()
public void setOption(java.lang.String optionStr)
optionStr - string to decode option fromjava.lang.IllegalArgumentException - if unable to decodepublic int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypespublic void visitToken(DetailAST ast)
AbstractCheckvisitToken in class AbstractCheckast - the token to processCopyright © 2001-2019. All Rights Reserved.