本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.TYPE_ARGUMENTS属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.TYPE_ARGUMENTS属性的具体用法?Java TokenTypes.TYPE_ARGUMENTS怎么用?Java TokenTypes.TYPE_ARGUMENTS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.TYPE_ARGUMENTS属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCanonicalName
/**
* Gets canonical type's name from given {@link TokenTypes#TYPE TYPE} node.
* @param type DetailAST {@link TokenTypes#TYPE TYPE} node.
* @return canonical type's name
*/
private static String getCanonicalName(DetailAST type) {
final StringBuilder canonicalNameBuilder = new StringBuilder(256);
DetailAST toVisit = type.getFirstChild();
while (toVisit != null) {
toVisit = getNextSubTreeNode(toVisit, type);
if (toVisit != null && toVisit.getType() == TokenTypes.IDENT) {
canonicalNameBuilder.append(toVisit.getText());
final DetailAST nextSubTreeNode = getNextSubTreeNode(toVisit, type);
if (nextSubTreeNode != null) {
if (nextSubTreeNode.getType() == TokenTypes.TYPE_ARGUMENTS) {
break;
}
canonicalNameBuilder.append('.');
}
}
}
return canonicalNameBuilder.toString();
}
示例2: isSameNameMethod
/**
* Is same name of method.
* @param ast method AST
* @return true if method name is the same
*/
private boolean isSameNameMethod(DetailAST ast) {
AST sibling = ast.getNextSibling();
// ignore type parameters
if (sibling != null
&& sibling.getType() == TokenTypes.TYPE_ARGUMENTS) {
sibling = sibling.getNextSibling();
}
return sibling == null || !getMethodName().equals(sibling.getText());
}
示例3: isGenericBeforeMethod
/**
* Is generic before method reference.
* @param ast ast
* @return true if generic before a method ref
*/
private static boolean isGenericBeforeMethod(DetailAST ast) {
return ast.getParent().getType() == TokenTypes.TYPE_ARGUMENTS
&& ast.getParent().getParent().getType() == TokenTypes.DOT
&& ast.getParent().getParent().getParent().getType() == TokenTypes.METHOD_CALL
|| isAfterMethodReference(ast);
}