Class BlockCommentPosition
java.lang.Object
com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition
Utility class that has methods to check javadoc comment position in java file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static DetailASTGet next sibling node skipping any comment nodes.private static DetailASTGet previous sibling node skipping any comments.static booleanisOnAnnotationDef(DetailAST blockComment) Node is on annotation definition.static booleanisOnAnnotationField(DetailAST blockComment) Node is on annotation field declaration.static booleanNode is on class definition.static booleanisOnCompactConstructor(DetailAST blockComment) Node is on compact constructor, note that we don't need to check for a plain token here, since a compact constructor must be public.static booleanisOnConstructor(DetailAST blockComment) Node is on constructor.static booleanNode is on enum definition.static booleanisOnEnumConstant(DetailAST blockComment) Node is on enum constant.static booleanNode is on field declaration.static booleanisOnInterface(DetailAST blockComment) Node is on interface definition.static booleanisOnMember(DetailAST blockComment) Node is on type member declaration.static booleanisOnMethod(DetailAST blockComment) Node is on method declaration.static booleanisOnPackage(DetailAST blockComment) Node is on package definition.private static booleanisOnPlainClassMember(DetailAST blockComment) 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.static booleanisOnRecord(DetailAST blockComment) Node is on record definition.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.static booleanNode is on type definition.
-
Constructor Details
-
BlockCommentPosition
private BlockCommentPosition()Forbid new instances.
-
-
Method Details
-
isOnType
Node is on type definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before class, interface, enum or annotation.
-
isOnClass
Node is on class definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before class
-
isOnRecord
Node is on record definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before class
-
isOnPackage
Node is on package definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before package
-
isOnInterface
Node is on interface definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before interface
-
isOnEnum
Node is on enum definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before enum
-
isOnAnnotationDef
Node is on annotation definition.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before annotation
-
isOnMember
Node is on type member declaration.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before method, field, constructor, enum constant or annotation field
-
isOnMethod
Node is on method declaration.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before method
-
isOnField
Node is on field declaration.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before field
-
isOnConstructor
Node is on constructor.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before constructor
-
isOnCompactConstructor
Node is on compact constructor, note that we don't need to check for a plain token here, since a compact constructor must be public.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before compact constructor
-
isOnEnumConstant
Node is on enum constant.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before enum constant
-
isOnAnnotationField
Node is on annotation field declaration.- Parameters:
blockComment- DetailAST- Returns:
- true if node is before annotation field
-
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
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
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
Checks that block comment is on specified class member without any modifiers.- Parameters:
blockComment- block comment start DetailAST- Returns:
- true if block comment is on specified token without modifiers
-
getNextSiblingSkipComments
Get next sibling node skipping any comment nodes.- Parameters:
node- current node- Returns:
- next sibling
-
getPrevSiblingSkipComments
Get previous sibling node skipping any comments.- Parameters:
node- current node- Returns:
- previous sibling
-