本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.LITERAL_PRIVATE属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.LITERAL_PRIVATE属性的具体用法?Java TokenTypes.LITERAL_PRIVATE怎么用?Java TokenTypes.LITERAL_PRIVATE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.LITERAL_PRIVATE属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVisibility
public int getVisibility() {
int result = DEFAULT_VISIBILITY;
SymTabAST visibilityNode = getVisibilityNode();
if (visibilityNode != null) {
if (visibilityNode.getType() == TokenTypes.LITERAL_PRIVATE) {
result = PRIVATE_VISIBILITY;
}
else if (
visibilityNode.getType() == TokenTypes.LITERAL_PROTECTED) {
result = PROTECTED_VISIBILITY;
}
else if (visibilityNode.getType() == TokenTypes.LITERAL_PUBLIC) {
result = PUBLIC_VISIBILITY;
}
}
return result;
}
示例2: getAccessModifierFromModifiersToken
/**
* Returns {@link AccessModifier} based on the information about access modifier
* taken from the given token of type {@link TokenTypes#MODIFIERS}.
* @param modifiersToken token of type {@link TokenTypes#MODIFIERS}.
* @return {@link AccessModifier}.
*/
public static AccessModifier getAccessModifierFromModifiersToken(DetailAST modifiersToken) {
if (modifiersToken == null || modifiersToken.getType() != TokenTypes.MODIFIERS) {
throw new IllegalArgumentException("expected non-null AST-token with type 'MODIFIERS'");
}
// default access modifier
AccessModifier accessModifier = AccessModifier.PACKAGE;
for (AST token = modifiersToken.getFirstChild(); token != null;
token = token.getNextSibling()) {
final int tokenType = token.getType();
if (tokenType == TokenTypes.LITERAL_PUBLIC) {
accessModifier = AccessModifier.PUBLIC;
}
else if (tokenType == TokenTypes.LITERAL_PROTECTED) {
accessModifier = AccessModifier.PROTECTED;
}
else if (tokenType == TokenTypes.LITERAL_PRIVATE) {
accessModifier = AccessModifier.PRIVATE;
}
}
return accessModifier;
}
示例3: isVisibilityNode
private boolean isVisibilityNode(SymTabAST node) {
return (
node.getType() == TokenTypes.LITERAL_PUBLIC
|| node.getType() == TokenTypes.LITERAL_PROTECTED
|| node.getType() == TokenTypes.LITERAL_PRIVATE);
}