本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.ABSTRACT属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.ABSTRACT属性的具体用法?Java TokenTypes.ABSTRACT怎么用?Java TokenTypes.ABSTRACT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.ABSTRACT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processInterfaceOrAnnotation
/**
* Do validation of interface of annotation.
* @param ast token AST
*/
private void processInterfaceOrAnnotation(DetailAST ast) {
final DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS);
DetailAST modifier = modifiers.getFirstChild();
while (modifier != null) {
// javac does not allow final or static in interface methods
// order annotation fields hence no need to check that this
// is not a method or annotation field
final int type = modifier.getType();
if (type == TokenTypes.LITERAL_PUBLIC
|| type == TokenTypes.LITERAL_STATIC
&& ast.getType() != TokenTypes.METHOD_DEF
|| type == TokenTypes.ABSTRACT
&& ast.getType() != TokenTypes.CLASS_DEF
|| type == TokenTypes.FINAL
&& ast.getType() != TokenTypes.CLASS_DEF) {
log(modifier.getLineNo(), modifier.getColumnNo(),
MSG_KEY, modifier.getText());
break;
}
modifier = modifier.getNextSibling();
}
}
示例2: getDefaultTokens
/**
* @return the tokens that are delivered from the parser to this class.
*/
@Override
public int[] getDefaultTokens() {
return new int[] { TokenTypes.ABSTRACT, TokenTypes.PACKAGE_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.CLASS_DEF,
TokenTypes.ANNOTATION, TokenTypes.IMPORT, TokenTypes.IMPLEMENTS_CLAUSE, TokenTypes.EXTENDS_CLAUSE,
TokenTypes.TYPE };
}
示例3: visitToken
/** {@inheritDoc} */
@Override
public void visitToken(DetailAST ast) {
logAstDetails(ast);
if (this.isInnerClass) {
// ignore Inner classes
return;
}
int tokenType = ast.getType();
switch (tokenType) {
case TokenTypes.PACKAGE_DEF:
addPackagename(ast);
break;
case TokenTypes.IMPORT:
addImport(ast);
break;
case TokenTypes.ABSTRACT:
setAbstractType(ast);
break;
case TokenTypes.CLASS_DEF:
if (this.currentClass.getClassName() != null) {
this.isInnerClass = true;
return;
}
setClassType(ast);
break;
case TokenTypes.ANNOTATION_DEF:
setAnnotationType(ast);
break;
case TokenTypes.INTERFACE_DEF:
setInterfaceType(ast);
break;
case TokenTypes.ANNOTATION:
addAnnotation(ast);
break;
case TokenTypes.EXTENDS_CLAUSE:
addBaseClass(ast);
break;
case TokenTypes.IMPLEMENTS_CLAUSE:
addInterface(ast);
break;
case TokenTypes.TYPE:
addImportFromFullQualifiedType(ast);
break;
default:
break;
}
}