Class BlockCommentPosition
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition
-
public final class BlockCommentPosition extends java.lang.ObjectUtility class that has methods to check javadoc comment position in java file.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateBlockCommentPosition()Forbid new instances.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static DetailASTgetNextSiblingSkipComments(DetailAST node)Get next sibling node skipping any comment nodes.private static DetailASTgetPrevSiblingSkipComments(DetailAST node)Get previous sibling node skipping any comments.static booleanisOnAnnotationDef(DetailAST blockComment)Node is on annotation definition.static booleanisOnClass(DetailAST blockComment)Node is on class definition.static booleanisOnConstructor(DetailAST blockComment)Node is on constructor.static booleanisOnEnum(DetailAST blockComment)Node is on enum definition.static booleanisOnEnumConstant(DetailAST blockComment)Node is on enum constant.static booleanisOnField(DetailAST blockComment)Node is on field declaration.static booleanisOnInterface(DetailAST blockComment)Node is on interface definition.static booleanisOnMethod(DetailAST blockComment)Node is on method declaration.private static booleanisOnPlainClassMember(DetailAST blockComment, int memberType)Checks that block comment is on specified class member without any modifiers.private static booleanisOnPlainToken(DetailAST blockComment, int parentTokenType, int nextTokenType)Checks that block comment is on specified token without any modifiers.private static booleanisOnTokenWithAnnotation(DetailAST blockComment, int tokenType)Checks that block comment is on specified token with annotation.private static booleanisOnTokenWithModifiers(DetailAST blockComment, int tokenType)Checks that block comment is on specified token with modifiers.
-
-
-
Method Detail
-
isOnClass
public static boolean isOnClass(DetailAST blockComment)
Node is on class definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before class
-
isOnInterface
public static boolean isOnInterface(DetailAST blockComment)
Node is on interface definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before interface
-
isOnEnum
public static boolean isOnEnum(DetailAST blockComment)
Node is on enum definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before enum
-
isOnAnnotationDef
public static boolean isOnAnnotationDef(DetailAST blockComment)
Node is on annotation definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before annotation
-
isOnMethod
public static boolean isOnMethod(DetailAST blockComment)
Node is on method declaration.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before method
-
isOnField
public static boolean isOnField(DetailAST blockComment)
Node is on field declaration.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before field
-
isOnConstructor
public static boolean isOnConstructor(DetailAST blockComment)
Node is on constructor.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before constructor
-
isOnEnumConstant
public static boolean isOnEnumConstant(DetailAST blockComment)
Node is on enum constant.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before enum constant
-
isOnPlainToken
private static boolean isOnPlainToken(DetailAST blockComment, int parentTokenType, int nextTokenType)
Checks that block comment is on specified token without any modifiers.- Parameters:
blockComment- block comment start DetailASTparentTokenType- parent token typenextTokenType- next token type- Returns:
- true if block comment is on specified token without modifiers
-
isOnTokenWithModifiers
private static boolean isOnTokenWithModifiers(DetailAST blockComment, int tokenType)
Checks that block comment is on specified token with modifiers.- Parameters:
blockComment- block comment start DetailASTtokenType- parent token type- Returns:
- true if block comment is on specified token with modifiers
-
isOnTokenWithAnnotation
private static boolean isOnTokenWithAnnotation(DetailAST blockComment, int tokenType)
Checks that block comment is on specified token with annotation.- Parameters:
blockComment- block comment start DetailASTtokenType- parent token type- Returns:
- true if block comment is on specified token with annotation
-
isOnPlainClassMember
private static boolean isOnPlainClassMember(DetailAST blockComment, int memberType)
Checks that block comment is on specified class member without any modifiers.- Parameters:
blockComment- block comment start DetailASTmemberType- parent token type- Returns:
- true if block comment is on specified token without modifiers
-
getNextSiblingSkipComments
private static DetailAST getNextSiblingSkipComments(DetailAST node)
Get next sibling node skipping any comment nodes.- Parameters:
node- current node- Returns:
- next sibling
-
-