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


Java FullIdent.getText方法代码示例

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


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

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

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

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

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

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

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

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

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

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

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

示例11: isFirstParameterObject

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
/**
 * Tests whether a method's first parameter is an Object.
 * @param methodDefAst the method definition AST to test.
 *     Precondition: ast is a TokenTypes.METHOD_DEF node.
 * @return true if ast has first parameter of type Object.
 */
private static boolean isFirstParameterObject(DetailAST methodDefAst) {
    final DetailAST paramsNode = methodDefAst.findFirstToken(TokenTypes.PARAMETERS);

    // parameter type "Object"?
    final DetailAST paramNode =
        paramsNode.findFirstToken(TokenTypes.PARAMETER_DEF);
    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,代码行数:18,代码来源:CovariantEqualsCheck.java

示例12: getImportText

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
/**
 * Returns import text.
 * @param ast ast node that represents import
 * @return String that represents importing class
 */
private static String getImportText(DetailAST ast) {
    final FullIdent imp;
    if (ast.getType() == TokenTypes.IMPORT) {
        imp = FullIdent.createFullIdentBelow(ast);
    }
    else {
        // know it is a static import
        imp = FullIdent.createFullIdent(ast
                .getFirstChild().getNextSibling());
    }
    return imp.getText();
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:18,代码来源:ImportControlCheck.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: Token

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
/**
 * Converts FullIdent to Token.
 * @param fullIdent full ident to convert.
 */
public Token(FullIdent fullIdent) {
    text = fullIdent.getText();
    lineNo = fullIdent.getLineNo();
    columnNo = fullIdent.getColumnNo();
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:10,代码来源:AbstractTypeAwareCheck.java

示例15: getTypeName

import com.puppycrawl.tools.checkstyle.api.FullIdent; //导入方法依赖的package包/类
public static String getTypeName(final DetailAST ast) {
    final FullIdent ident = CheckUtils.createFullType(ast.findFirstToken(TokenTypes.TYPE));
    return ident.getText();
}
 
开发者ID:opendaylight,项目名称:yangtools,代码行数:5,代码来源:CheckLoggingUtil.java


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