本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.FullIdent类的典型用法代码示例。如果您正苦于以下问题:Java FullIdent类的具体用法?Java FullIdent怎么用?Java FullIdent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FullIdent类属于com.puppycrawl.tools.checkstyle.api包,在下文中一共展示了FullIdent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
@Override
public void visitToken(DetailAST ast) {
defined = true;
if (matchDirectoryStructure) {
final DetailAST packageNameAst = ast.getLastChild().getPreviousSibling();
final FullIdent fullIdent = FullIdent.createFullIdent(packageNameAst);
final String packageName = fullIdent.getText().replace('.', File.separatorChar);
final String directoryName = getDirectoryName();
if (!directoryName.endsWith(packageName)) {
log(fullIdent.getLineNo(), MSG_KEY_MISMATCH, packageName);
}
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:18,代码来源:PackageDeclarationCheck.java
示例2: visitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
@Override
public void visitToken(DetailAST detailAST) {
final DetailAST parameterDef =
detailAST.findFirstToken(TokenTypes.PARAMETER_DEF);
final DetailAST excTypeParent =
parameterDef.findFirstToken(TokenTypes.TYPE);
final List<DetailAST> excTypes = getAllExceptionTypes(excTypeParent);
for (DetailAST excType : excTypes) {
final FullIdent ident = FullIdent.createFullIdent(excType);
if (illegalClassNames.contains(ident.getText())) {
log(detailAST, MSG_KEY, ident.getText());
}
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:17,代码来源:IllegalCatchCheck.java
示例3: postProcessLiteralNew
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Processes one of the collected "new" tokens when walking tree
* has finished.
* @param newTokenAst the "new" token.
*/
private void postProcessLiteralNew(DetailAST newTokenAst) {
final DetailAST typeNameAst = newTokenAst.getFirstChild();
final AST nameSibling = typeNameAst.getNextSibling();
if (nameSibling.getType() != TokenTypes.ARRAY_DECLARATOR) {
// ast != "new Boolean[]"
final FullIdent typeIdent = FullIdent.createFullIdent(typeNameAst);
final String typeName = typeIdent.getText();
final String fqClassName = getIllegalInstantiation(typeName);
if (fqClassName != null) {
final int lineNo = newTokenAst.getLineNo();
final int colNo = newTokenAst.getColumnNo();
log(lineNo, colNo, MSG_KEY, fqClassName);
}
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:21,代码来源:IllegalInstantiationCheck.java
示例4: checkImportStatements
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Check import statements.
* @param className name of the class
* @return value of illegal instantiated type
*/
private String checkImportStatements(String className) {
String illegalType = null;
// import statements
for (FullIdent importLineText : imports) {
String importArg = importLineText.getText();
if (importArg.endsWith(".*")) {
importArg = importArg.substring(0, importArg.length() - 1)
+ className;
}
if (CommonUtils.baseClassName(importArg).equals(className)
&& illegalClasses.contains(importArg)) {
illegalType = importArg;
break;
}
}
return illegalType;
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:23,代码来源:IllegalInstantiationCheck.java
示例5: visitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
@Override
public void visitToken(DetailAST detailAST) {
final DetailAST methodDef = detailAST.getParent();
// Check if the method with the given name should be ignored.
if (!isIgnorableMethod(methodDef)) {
DetailAST token = detailAST.getFirstChild();
while (token != null) {
if (token.getType() != TokenTypes.COMMA) {
final FullIdent ident = FullIdent.createFullIdent(token);
if (illegalClassNames.contains(ident.getText())) {
log(token, MSG_KEY, ident.getText());
}
}
token = token.getNextSibling();
}
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:18,代码来源:IllegalThrowsCheck.java
示例6: getThrows
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Computes the exception nodes for a method.
*
* @param ast the method node.
* @return the list of exception nodes for ast.
*/
private List<ExceptionInfo> getThrows(DetailAST ast) {
final List<ExceptionInfo> returnValue = new ArrayList<ExceptionInfo>();
final DetailAST throwsAST = ast
.findFirstToken(TokenTypes.LITERAL_THROWS);
if (throwsAST != null) {
DetailAST child = throwsAST.getFirstChild();
while (child != null) {
if (child.getType() == TokenTypes.IDENT
|| child.getType() == TokenTypes.DOT) {
final FullIdent ident = FullIdent.createFullIdent(child);
final ExceptionInfo exceptionInfo = new ExceptionInfo(
createClassInfo(new Token(ident), getCurrentClassName()));
returnValue.add(exceptionInfo);
}
child = child.getNextSibling();
}
}
return returnValue;
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:26,代码来源:JavadocMethodCheck.java
示例7: doVisitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Shares processing...
*
* @param ident the import to process.
* @param isStatic whether the token is static or not.
* @param previous previous non-static but current is static (above), or
* previous static but current is non-static (under).
*/
private void doVisitToken(FullIdent ident, boolean isStatic,
boolean previous) {
final String name = ident.getText();
final int groupIdx = getGroupNumber(name);
final int line = ident.getLineNo();
if (groupIdx > lastGroup) {
if (!beforeFirstImport && separated && line - lastImportLine < 2
&& !isInSameGroup(groupIdx, isStatic)) {
log(line, MSG_SEPARATION, name);
}
}
else if (isInSameGroup(groupIdx, isStatic)) {
doVisitTokenInSameGroup(isStatic, previous, name, line);
}
else {
log(line, MSG_ORDERING, name);
}
if (isSeparatorInGroup(groupIdx, isStatic, line)) {
log(line, MSG_SEPARATED_IN_GROUP, name);
}
lastGroup = groupIdx;
lastImport = name;
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:34,代码来源:ImportOrderCheck.java
示例8: visitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
@Override
public void visitToken(DetailAST ast) {
final FullIdent imp;
if (ast.getType() == TokenTypes.IMPORT) {
imp = FullIdent.createFullIdentBelow(ast);
}
else {
imp = FullIdent.createFullIdent(
ast.getFirstChild().getNextSibling());
}
if (isIllegalImport(imp.getText())) {
log(ast.getLineNo(),
ast.getColumnNo(),
MSG_KEY,
imp.getText());
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:18,代码来源:IllegalImportCheck.java
示例9: visitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
@Override
public void visitToken(DetailAST aAST) {
final FullIdent imp;
if ( aAST.getType() == TokenTypes.IMPORT ) {
imp = FullIdent.createFullIdentBelow( aAST );
}
else {
// handle case of static imports of method names
imp = FullIdent.createFullIdent( aAST.getFirstChild().getNextSibling() );
}
final String text = imp.getText();
if ( isIllegalImport( text ) ) {
final String message = buildError( text );
log( aAST.getLineNo(), aAST.getColumnNo(), message, text );
}
}
开发者ID:Hotware,项目名称:Hibernate-Search-GenericJPA,代码行数:17,代码来源:IllegalImport.java
示例10: visitToken
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
@Override
public void visitToken(DetailAST ast) {
defined = true;
if (matchDirectoryStructure) {
final DetailAST packageNameAst = ast.getLastChild().getPreviousSibling();
final FullIdent fullIdent = FullIdent.createFullIdent(packageNameAst);
final String packageName = fullIdent.getText().replace('.', File.separatorChar);
final String directoryName = getDirectoryName();
if (!directoryName.endsWith(packageName)) {
log(fullIdent.getLineNo(), MSG_KEY_MISMATCH, packageName);
}
}
}
开发者ID:checkstyle,项目名称:checkstyle,代码行数:17,代码来源:PackageDeclarationCheck.java
示例11: checkImportStatements
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Check import statements.
* @param className name of the class
* @return value of illegal instantiated type
*/
private String checkImportStatements(String className) {
String illegalType = null;
// import statements
for (FullIdent importLineText : imports) {
String importArg = importLineText.getText();
if (importArg.endsWith(".*")) {
importArg = importArg.substring(0, importArg.length() - 1)
+ className;
}
if (CommonUtils.baseClassName(importArg).equals(className)
&& classes.contains(importArg)) {
illegalType = importArg;
break;
}
}
return illegalType;
}
开发者ID:checkstyle,项目名称:checkstyle,代码行数:23,代码来源:IllegalInstantiationCheck.java
示例12: getThrows
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Computes the exception nodes for a method.
*
* @param ast the method node.
* @return the list of exception nodes for ast.
*/
private List<ExceptionInfo> getThrows(DetailAST ast) {
final List<ExceptionInfo> returnValue = new ArrayList<>();
final DetailAST throwsAST = ast
.findFirstToken(TokenTypes.LITERAL_THROWS);
if (throwsAST != null) {
DetailAST child = throwsAST.getFirstChild();
while (child != null) {
if (child.getType() == TokenTypes.IDENT
|| child.getType() == TokenTypes.DOT) {
final FullIdent ident = FullIdent.createFullIdent(child);
final ExceptionInfo exceptionInfo = new ExceptionInfo(
createClassInfo(new Token(ident), getCurrentClassName()));
returnValue.add(exceptionInfo);
}
child = child.getNextSibling();
}
}
return returnValue;
}
开发者ID:checkstyle,项目名称:checkstyle,代码行数:26,代码来源:JavadocMethodCheck.java
示例13: addImportFromFullQualifiedType
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
private void addImportFromFullQualifiedType(DetailAST ast) {
if (isClassType(ast)) {
String typeName = FullIdent.createFullIdent(ast.getLastChild()).getText();
if (typeName.indexOf(".") == -1) {
if (!this.currentClass.hasImport(typeName)) {
String currentImport = this.currentClass.getPackageName() + "." + typeName;
this.currentClass.addImport(currentImport, ast);
logger.fine("import: " + currentImport);
}
} else {
this.currentClass.addImport(typeName, ast);
logger.fine("import: " + typeName);
}
}
}
开发者ID:NovaTecConsulting,项目名称:stereotype-check,代码行数:16,代码来源:StereotypeCheck.java
示例14: addImport
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
private void addImport(DetailAST ast) {
DetailAST nameAST;
FullIdent full;
nameAST = ast.getLastChild().getPreviousSibling();
full = FullIdent.createFullIdent(nameAST);
String currentImport = full.getText();
this.currentClass.addImport(currentImport, ast);
logger.fine("import: " + currentImport);
}
开发者ID:NovaTecConsulting,项目名称:stereotype-check,代码行数:10,代码来源:StereotypeCheck.java
示例15: addPackagename
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
private void addPackagename(DetailAST ast) {
DetailAST nameAST;
FullIdent full;
nameAST = ast.getLastChild().getPreviousSibling();
full = FullIdent.createFullIdent(nameAST);
String packageName = full.getText();
this.currentClass.setPackageName(packageName);
logger.fine("package name: " + packageName);
}
开发者ID:NovaTecConsulting,项目名称:stereotype-check,代码行数:10,代码来源:StereotypeCheck.java
示例16: registerImport
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Registers given import. This allows us to track imported classes.
* @param imp import definition.
*/
public void registerImport(DetailAST imp) {
final FullIdent ident = FullIdent.createFullIdent(
imp.getLastChild().getPreviousSibling());
final String fullName = ident.getText();
if (fullName.charAt(fullName.length() - 1) != '*') {
final int lastDot = fullName.lastIndexOf(DOT);
importedClassPackage.put(fullName.substring(lastDot + 1), fullName);
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:14,代码来源:AbstractClassCouplingCheck.java
示例17: checkClassName
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Checks type of given method, parameter or variable.
* @param ast node to check.
*/
private void checkClassName(DetailAST ast) {
final DetailAST type = ast.findFirstToken(TokenTypes.TYPE);
final FullIdent ident = CheckUtils.createFullType(type);
if (isMatchingClassName(ident.getText())) {
log(ident.getLineNo(), ident.getColumnNo(),
MSG_KEY, ident.getText());
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:14,代码来源:IllegalTypeCheck.java
示例18: isObjectParam
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Determines if an AST is a formal param of type Object.
* @param paramNode the AST to check
* @return true if firstChild is a parameter of an Object type.
*/
private static boolean isObjectParam(DetailAST paramNode) {
final DetailAST typeNode = paramNode.findFirstToken(TokenTypes.TYPE);
final FullIdent fullIdent = FullIdent.createFullIdentBelow(typeNode);
final String name = fullIdent.getText();
return "Object".equals(name) || "java.lang.Object".equals(name);
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:EqualsHashCodeCheck.java
示例19: processImport
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Perform processing for an import token.
* @param ast the import token
*/
private void processImport(DetailAST ast) {
final FullIdent name = FullIdent.createFullIdentBelow(ast);
// Note: different from UnusedImportsCheck.processImport(),
// '.*' imports are also added here
imports.add(name);
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:11,代码来源:IllegalInstantiationCheck.java
示例20: processPackageDef
import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入依赖的package包/类
/**
* Perform processing for an package token.
* @param ast the package token
*/
private void processPackageDef(DetailAST ast) {
final DetailAST packageNameAST = ast.getLastChild()
.getPreviousSibling();
final FullIdent packageIdent =
FullIdent.createFullIdent(packageNameAST);
pkgName = packageIdent.getText();
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:IllegalInstantiationCheck.java
注:本文中的com.puppycrawl.tools.checkstyle.api.FullIdent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论