|
| 1 | +package com.ibm.cldk.entities; |
| 2 | + |
| 3 | +import lombok.Data; |
| 4 | + |
| 5 | +/** |
| 6 | + * Represents a comment entity extracted from source code. |
| 7 | + * This class encapsulates information about the content, position, |
| 8 | + * and type of a comment within a source file. |
| 9 | + * |
| 10 | + * <p> |
| 11 | + * The comment can be of various types, including Javadoc, block comments, or line comments. |
| 12 | + * The class also keeps track of the comment's position within the file (line and column numbers). |
| 13 | + * </p> |
| 14 | + * |
| 15 | + * <p> |
| 16 | + * This class leverages Lombok's {@code @Data} annotation to automatically generate |
| 17 | + * getters, setters, {@code toString()}, {@code equals()}, and {@code hashCode()} methods. |
| 18 | + * </p> |
| 19 | + * |
| 20 | + * Example usage: |
| 21 | + * <pre> |
| 22 | + * Comment comment = new Comment(); |
| 23 | + * comment.setContent("This is a sample comment."); |
| 24 | + * comment.setStartLine(10); |
| 25 | + * comment.setEndLine(12); |
| 26 | + * comment.setJavadoc(true); |
| 27 | + * </pre> |
| 28 | + * |
| 29 | + * @author Rahul Krishna |
| 30 | + * @version 2.3.0 |
| 31 | + */ |
| 32 | +@Data |
| 33 | +public class Comment { |
| 34 | + |
| 35 | + /** |
| 36 | + * The textual content of the comment. |
| 37 | + */ |
| 38 | + private String content; |
| 39 | + |
| 40 | + /** |
| 41 | + * The starting line number of the comment in the source file. |
| 42 | + * <p> |
| 43 | + * Defaults to {@code -1} if the position is unknown. |
| 44 | + * </p> |
| 45 | + */ |
| 46 | + private int startLine = -1; |
| 47 | + |
| 48 | + /** |
| 49 | + * The ending line number of the comment in the source file. |
| 50 | + * <p> |
| 51 | + * Defaults to {@code -1} if the position is unknown. |
| 52 | + * </p> |
| 53 | + */ |
| 54 | + private int endLine = -1; |
| 55 | + |
| 56 | + /** |
| 57 | + * The starting column number of the comment in the source file. |
| 58 | + * <p> |
| 59 | + * Defaults to {@code -1} if the position is unknown. |
| 60 | + * </p> |
| 61 | + */ |
| 62 | + private int startColumn = -1; |
| 63 | + |
| 64 | + /** |
| 65 | + * The ending column number of the comment in the source file. |
| 66 | + * <p> |
| 67 | + * Defaults to {@code -1} if the position is unknown. |
| 68 | + * </p> |
| 69 | + */ |
| 70 | + private int endColumn = -1; |
| 71 | + |
| 72 | + /** |
| 73 | + * Indicates whether the comment is a Javadoc comment. |
| 74 | + * <p> |
| 75 | + * Javadoc comments are special block comments used for generating documentation |
| 76 | + * and typically start with {@code /**}. |
| 77 | + * </p> |
| 78 | + */ |
| 79 | + private boolean isJavadoc = false; |
| 80 | +} |
0 commit comments