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


Java TokenTypes.STATIC_IMPORT属性代码示例

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


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

示例1: visitToken

@Override
public void visitToken(DetailAST ast) {
    if (ast.getType() == TokenTypes.IDENT) {
        if (collect) {
            processIdent(ast);
        }
    }
    else if (ast.getType() == TokenTypes.IMPORT) {
        processImport(ast);
    }
    else if (ast.getType() == TokenTypes.STATIC_IMPORT) {
        processStaticImport(ast);
    }
    else {
        collect = true;
        if (processJavadoc) {
            collectReferencesFromJavadoc(ast);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:20,代码来源:UnusedImportsCheck.java

示例2: visitToken

@Override
public void visitToken(DetailAST ast) {
    if (ast.getType() == TokenTypes.PACKAGE_DEF) {
        if (customImportOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) {
            samePackageDomainsRegExp = createSamePackageRegexp(
                    samePackageMatchingDepth, ast);
        }
    }
    else {
        final String importFullPath = getFullImportIdent(ast);
        final int lineNo = ast.getLineNo();
        final boolean isStatic = ast.getType() == TokenTypes.STATIC_IMPORT;
        importToGroupList.add(new ImportDetails(importFullPath,
                lineNo, getImportGroup(isStatic, importFullPath),
                isStatic));
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:17,代码来源:CustomImportOrderCheck.java

示例3: testGetRequiredTokens

@Test
public void testGetRequiredTokens() {
    final UnusedImportsCheck testCheckObject =
            new UnusedImportsCheck();
    final int[] actual = testCheckObject.getRequiredTokens();
    final int[] expected = {
        TokenTypes.IDENT,
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        // Definitions that may contain Javadoc...
        TokenTypes.PACKAGE_DEF,
        TokenTypes.ANNOTATION_DEF,
        TokenTypes.ANNOTATION_FIELD_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.ENUM_CONSTANT_DEF,
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.VARIABLE_DEF,
    };

    assertArrayEquals("Default required tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:24,代码来源:UnusedImportsCheckTest.java

示例4: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final UnusedImportsCheck testCheckObject =
            new UnusedImportsCheck();
    final int[] actual = testCheckObject.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.IDENT,
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        // Definitions that may contain Javadoc...
        TokenTypes.PACKAGE_DEF,
        TokenTypes.ANNOTATION_DEF,
        TokenTypes.ANNOTATION_FIELD_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.ENUM_CONSTANT_DEF,
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.VARIABLE_DEF,
    };

    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:24,代码来源:UnusedImportsCheckTest.java

示例5: testGetRequiredTokens

@Test
public void testGetRequiredTokens() {
    final AvoidStarImportCheck testCheckObject =
            new AvoidStarImportCheck();
    final int[] actual = testCheckObject.getRequiredTokens();
    final int[] expected = {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};

    assertArrayEquals("Default required tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:9,代码来源:AvoidStarImportCheckTest.java

示例6: getAcceptableTokens

@Override
public int[] getAcceptableTokens() {
    return new int[] {
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        TokenTypes.PACKAGE_DEF,
        TokenTypes.CLASS_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.INTERFACE_DEF,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:NoLineWrapCheck.java

示例7: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final AvoidStarImportCheck testCheckObject =
            new AvoidStarImportCheck();
    final int[] actual = testCheckObject.getAcceptableTokens();
    final int[] expected = {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};
    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:8,代码来源:AvoidStarImportCheckTest.java

示例8: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final ImportControlCheck testCheckObject =
            new ImportControlCheck();
    final int[] actual = testCheckObject.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.PACKAGE_DEF,
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
    };

    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:ImportControlCheckTest.java

示例9: getRequiredTokens

@Override
public int[] getRequiredTokens() {
    return new int[] {
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        TokenTypes.PACKAGE_DEF,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:8,代码来源:CustomImportOrderCheck.java

示例10: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final RedundantImportCheck testCheckObject =
            new RedundantImportCheck();
    final int[] actual = testCheckObject.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        TokenTypes.PACKAGE_DEF,
    };

    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:RedundantImportCheckTest.java

示例11: getRequiredTokens

@Override
public int[] getRequiredTokens() {
    // original implementation checks both IMPORT and STATIC_IMPORT tokens to avoid ".*" imports
    // however user can allow using "import" or "import static"
    // by configuring allowClassImports and allowStaticMemberImports
    // To avoid potential confusion when user specifies conflicting options on configuration
    // (see example below) we are adding both tokens to Required list
    //   <module name="AvoidStarImport">
    //      <property name="tokens" value="IMPORT"/>
    //      <property name="allowStaticMemberImports" value="false"/>
    //   </module>
    return new int[] {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:AvoidStarImportCheck.java

示例12: testGetRequiredTokens

@Test
public void testGetRequiredTokens() {
    final AvoidStaticImportCheck checkObj = new AvoidStaticImportCheck();
    final int[] expected = {TokenTypes.STATIC_IMPORT};
    assertArrayEquals("Default required tokens are invalid",
        expected, checkObj.getRequiredTokens());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:7,代码来源:AvoidStaticImportCheckTest.java

示例13: testGetRequiredTokens

@Test
public void testGetRequiredTokens() {
    final ImportControlCheck checkObj = new ImportControlCheck();
    final int[] expected = {
        TokenTypes.PACKAGE_DEF,
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
    };
    assertArrayEquals("Default required tokens are invalid",
        expected, checkObj.getRequiredTokens());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:11,代码来源:ImportControlCheckTest.java

示例14: testGetRequiredTokens

@Test
public void testGetRequiredTokens() {
    final CustomImportOrderCheck checkObj = new CustomImportOrderCheck();
    final int[] expected = {
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        TokenTypes.PACKAGE_DEF,
    };
    assertArrayEquals("Default required tokens are invalid",
        expected, checkObj.getRequiredTokens());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:11,代码来源:CustomImportOrderCheckTest.java

示例15: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final CustomImportOrderCheck testCheckObject =
            new CustomImportOrderCheck();
    final int[] actual = testCheckObject.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.IMPORT,
        TokenTypes.STATIC_IMPORT,
        TokenTypes.PACKAGE_DEF,
    };

    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:CustomImportOrderCheckTest.java


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