本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.IMPLEMENTS_CLAUSE属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.IMPLEMENTS_CLAUSE属性的具体用法?Java TokenTypes.IMPLEMENTS_CLAUSE怎么用?Java TokenTypes.IMPLEMENTS_CLAUSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.IMPLEMENTS_CLAUSE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
}
示例2: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final AnnotationLocationCheck constantNameCheckObj = new AnnotationLocationCheck();
final int[] actual = constantNameCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例3: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final AnnotationOnSameLineCheck constantNameCheckObj = new AnnotationOnSameLineCheck();
final int[] actual = constantNameCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例4: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
}
示例5: 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 };
}
示例6: getAcceptableParent
/**
* Returns parent of given ast if parent has one of the following types:
* ANNOTATION_DEF, PACKAGE_DEF, CLASS_DEF, ENUM_DEF, ENUM_CONSTANT_DEF, CTOR_DEF,
* METHOD_DEF, PARAMETER_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF, TYPE, LITERAL_NEW,
* LITERAL_THROWS, TYPE_ARGUMENT, IMPLEMENTS_CLAUSE, DOT.
* @param child an ast
* @return returns ast - parent of given
*/
private static DetailAST getAcceptableParent(DetailAST child) {
final DetailAST result;
final DetailAST parent = child.getParent();
switch (parent.getType()) {
case TokenTypes.ANNOTATION_DEF:
case TokenTypes.PACKAGE_DEF:
case TokenTypes.CLASS_DEF:
case TokenTypes.INTERFACE_DEF:
case TokenTypes.ENUM_DEF:
case TokenTypes.ENUM_CONSTANT_DEF:
case TokenTypes.CTOR_DEF:
case TokenTypes.METHOD_DEF:
case TokenTypes.PARAMETER_DEF:
case TokenTypes.VARIABLE_DEF:
case TokenTypes.ANNOTATION_FIELD_DEF:
case TokenTypes.TYPE:
case TokenTypes.LITERAL_NEW:
case TokenTypes.LITERAL_THROWS:
case TokenTypes.TYPE_ARGUMENT:
case TokenTypes.IMPLEMENTS_CLAUSE:
case TokenTypes.DOT:
result = parent;
break;
default:
// it's possible case, but shouldn't be processed here
result = null;
}
return result;
}
示例7: 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;
}
}