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


Java Scope.PRIVATE属性代码示例

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


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

示例1: equalScope

/**
 * Tests whether the scope of a field or method is compatible
 * with the scope of this check. References for compatible
 * fields or methods should be checked.
 * @param aFieldOrMethod the field or method to check.
 * @return true if the scope of aFieldOrMethod is compatible
 * with the scope of this check.
 */
private boolean equalScope(FieldOrMethod aFieldOrMethod)
{
    if (aFieldOrMethod.isPrivate()) {
        return (mScope == Scope.PRIVATE);
    }
    else if (aFieldOrMethod.isProtected()) {
        return (mScope == Scope.PROTECTED);
    }
    else if (aFieldOrMethod.isPublic()) {
        return (mScope == Scope.PUBLIC);
    }
    else {
        return (mScope == Scope.PACKAGE);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:AbstractReferenceCheck.java

示例2: getScopeFromMods

/**
 * Returns the Scope specified by the modifier set.
 *
 * @param aMods root node of a modifier set
 * @return a {@code Scope} value
 */
public static Scope getScopeFromMods(DetailAST aMods) {
    // default scope
    Scope returnValue = Scope.PACKAGE;
    for (AST token = aMods.getFirstChild(); token != null
            && returnValue == Scope.PACKAGE;
            token = token.getNextSibling()) {
        if ("public".equals(token.getText())) {
            returnValue = Scope.PUBLIC;
        }
        else if ("protected".equals(token.getText())) {
            returnValue = Scope.PROTECTED;
        }
        else if ("private".equals(token.getText())) {
            returnValue = Scope.PRIVATE;
        }
    }
    return returnValue;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:24,代码来源:ScopeUtils.java

示例3: mustCheckReferenceCount

/** @see com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck */
public boolean mustCheckReferenceCount(DetailAST aAST)
{
    final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
    return ((mods != null)
        && (ScopeUtils.getScopeFromMods(mods) == Scope.PRIVATE));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:7,代码来源:OneMethodPrivateFieldCheck.java

示例4: mustCheckReferenceCount

/** @see com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck */
public boolean mustCheckReferenceCount(DetailAST aAST)
{
    final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
    if ((mods == null)
        || (ScopeUtils.getScopeFromMods(mods) != Scope.PRIVATE))
    {
        return false;
    }

    return !mAllowSerializationMethods
           || !(isWriteObject(aAST) || isReadObject(aAST)
                || isWriteReplaceOrReadResolve(aAST));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:UnusedPrivateMethodCheck.java


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