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


Java TokenTypes.PACKAGE_DEF属性代码示例

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


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

示例1: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final EmptyLineSeparatorCheck emptyLineSeparatorCheckObj = new EmptyLineSeparatorCheck();
    final int[] actual = emptyLineSeparatorCheckObj.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.PACKAGE_DEF,
        TokenTypes.IMPORT,
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.STATIC_INIT,
        TokenTypes.INSTANCE_INIT,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.VARIABLE_DEF,
    };
    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:18,代码来源:EmptyLineSeparatorCheckTest.java

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

示例3: getRequiredTokens

@Override
public int[] getRequiredTokens() {
    return new int[] {
        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,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:UnusedImportsCheck.java

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

示例5: testGetRequiredTokens

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

示例6: getRequiredTokens

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

示例7: getRequiredTokens

@Override
public int[] getRequiredTokens() {
    return new int[] {
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.INSTANCE_INIT,
        TokenTypes.STATIC_INIT,
        TokenTypes.PACKAGE_DEF,
        TokenTypes.IMPORT,
        TokenTypes.VARIABLE_DEF,
        TokenTypes.CTOR_CALL,
        TokenTypes.SUPER_CTOR_CALL,
        TokenTypes.LITERAL_IF,
        TokenTypes.LITERAL_ELSE,
        TokenTypes.LITERAL_WHILE,
        TokenTypes.LITERAL_DO,
        TokenTypes.LITERAL_FOR,
        TokenTypes.LITERAL_SWITCH,
        TokenTypes.LITERAL_BREAK,
        TokenTypes.LITERAL_CONTINUE,
        TokenTypes.LITERAL_RETURN,
        TokenTypes.LITERAL_THROW,
        TokenTypes.LITERAL_SYNCHRONIZED,
        TokenTypes.LITERAL_CATCH,
        TokenTypes.LITERAL_FINALLY,
        TokenTypes.EXPR,
        TokenTypes.LABELED_STAT,
        TokenTypes.LITERAL_CASE,
        TokenTypes.LITERAL_DEFAULT,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:33,代码来源:JavaNCSSCheck.java

示例8: getAcceptableTokens

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

示例9: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final JavaNCSSCheck javaNcssCheckObj = new JavaNCSSCheck();
    final int[] actual = javaNcssCheckObj.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.INSTANCE_INIT,
        TokenTypes.STATIC_INIT,
        TokenTypes.PACKAGE_DEF,
        TokenTypes.IMPORT,
        TokenTypes.VARIABLE_DEF,
        TokenTypes.CTOR_CALL,
        TokenTypes.SUPER_CTOR_CALL,
        TokenTypes.LITERAL_IF,
        TokenTypes.LITERAL_ELSE,
        TokenTypes.LITERAL_WHILE,
        TokenTypes.LITERAL_DO,
        TokenTypes.LITERAL_FOR,
        TokenTypes.LITERAL_SWITCH,
        TokenTypes.LITERAL_BREAK,
        TokenTypes.LITERAL_CONTINUE,
        TokenTypes.LITERAL_RETURN,
        TokenTypes.LITERAL_THROW,
        TokenTypes.LITERAL_SYNCHRONIZED,
        TokenTypes.LITERAL_CATCH,
        TokenTypes.LITERAL_FINALLY,
        TokenTypes.EXPR,
        TokenTypes.LABELED_STAT,
        TokenTypes.LITERAL_CASE,
        TokenTypes.LITERAL_DEFAULT,
    };
    Assert.assertNotNull("Acceptable tokens should not be null", actual);
    Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:37,代码来源:JavaNCSSCheckTest.java

示例10: getAcceptableTokens

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

示例11: getAcceptableTokens

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

示例12: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final PackageAnnotationCheck constantNameCheckObj = new PackageAnnotationCheck();
    final int[] actual = constantNameCheckObj.getAcceptableTokens();
    final int[] expected = {TokenTypes.PACKAGE_DEF };
    Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:7,代码来源:PackageAnnotationCheckTest.java

示例13: getRequiredTokens

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

示例14: getPackageName

public static String getPackageName(DetailAST ast) {
  String packageName = null;
  for (DetailAST parent = ast; parent != null; parent = parent.getParent()) {
    if (parent.getType() == TokenTypes.PACKAGE_DEF) {
      packageName = getFullName(parent);
      break;
    }
  }
  return packageName;
}
 
开发者ID:startupheroes,项目名称:startupheroes-checkstyle,代码行数:10,代码来源:CommonUtil.java

示例15: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final FinalClassCheck obj = new FinalClassCheck();
    final int[] expected = {TokenTypes.CLASS_DEF, TokenTypes.CTOR_DEF, TokenTypes.PACKAGE_DEF};
    assertArrayEquals("Default acceptable tokens are invalid",
        expected, obj.getAcceptableTokens());
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:7,代码来源:FinalClassCheckTest.java


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