当前位置: 首页>>代码示例>>Java>>正文


Java FullIdent.createFullIdent方法代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.FullIdent.createFullIdent方法的典型用法代码示例。如果您正苦于以下问题:Java FullIdent.createFullIdent方法的具体用法?Java FullIdent.createFullIdent怎么用?Java FullIdent.createFullIdent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.puppycrawl.tools.checkstyle.api.FullIdent的用法示例。


在下文中一共展示了FullIdent.createFullIdent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: logsStarredImportViolation

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
/**
 * Gets the full import identifier.  If the import is a starred import and
 * it's not excluded then a violation is logged.
 * @param startingDot the starting dot for the import statement
 */
private void logsStarredImportViolation(DetailAST startingDot) {
    final FullIdent name = FullIdent.createFullIdent(startingDot);
    final String importText = name.getText();
    if (importText.endsWith(STAR_IMPORT_SUFFIX) && !excludes.contains(importText)) {
        log(startingDot.getLineNo(), MSG_KEY, importText);
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:AvoidStarImportCheck.java

示例14: visitToken

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
@Override
public void visitToken(DetailAST ast) {
    final DetailAST nameAST = ast.getLastChild().getPreviousSibling();
    final FullIdent full = FullIdent.createFullIdent(nameAST);
    if (!format.matcher(full.getText()).find()) {
        log(full.getLineNo(),
            full.getColumnNo(),
            MSG_KEY,
            full.getText(),
            format.pattern());
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:PackageNameCheck.java

示例15: createFullType

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
/**
 * Creates {@code FullIdent} for given type node.
 * @param typeAST a type node.
 * @return {@code FullIdent} for given type.
 */
public static FullIdent createFullType(final DetailAST typeAST) {
    DetailAST ast = typeAST;

    // ignore array part of type
    while (ast.findFirstToken(TokenTypes.ARRAY_DECLARATOR) != null) {
        ast = ast.findFirstToken(TokenTypes.ARRAY_DECLARATOR);
    }

    return FullIdent.createFullIdent(ast.getFirstChild());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:16,代码来源:CheckUtils.java


注:本文中的com.puppycrawl.tools.checkstyle.api.FullIdent.createFullIdent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。