Class CommentUtil


  • @Deprecated
    public final class CommentUtil
    extends java.lang.Object
    Deprecated.
    This utility class is deprecated and will be removed with PMD 7.0.0. Its methods have been intended to parse javadoc tags. A more useful solution will be added around the AST node FormalComment, which contains as children JavadocElement nodes, which in turn provide access to the JavadocTag.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String javadocContentAfter​(java.lang.String text, int position)
      Deprecated.
      This method is deprecated and will be removed with PMD 7.0.0.
      static java.util.Map<java.lang.String,​java.lang.Integer> javadocTagsIn​(java.lang.String comment)
      Deprecated.
      This method is deprecated and will be removed with PMD 7.0.0.
      static java.util.List<java.lang.String> multiLinesIn​(java.lang.String comment)
      Deprecated.
      This method will be removed with PMD 7.0.0.
      static java.util.List<java.lang.String> trim​(java.util.List<java.lang.String> lines)
      Deprecated.
      This method will be removed with PMD 7.0.0.
      static java.lang.String wordAfter​(java.lang.String text, int position)
      Deprecated.
      This method is deprecated and will be removed with PMD 7.0.0.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • wordAfter

        @Deprecated
        public static java.lang.String wordAfter​(java.lang.String text,
                                                 int position)
        Deprecated.
        This method is deprecated and will be removed with PMD 7.0.0. This method has been intended to parse javadoc tags. A more useful solution will be added around the AST node FormalComment, which contains as children JavadocElement nodes, which in turn provide access to the JavadocTag.
        Gets the next word (characters until next whitespace, punctuation, or anything that is not a letter or digit) at the given position.
        Parameters:
        text - the complete text
        position - the position, at which the word starts
        Returns:
        the word
      • javadocContentAfter

        @Deprecated
        public static java.lang.String javadocContentAfter​(java.lang.String text,
                                                           int position)
        Deprecated.
        This method is deprecated and will be removed with PMD 7.0.0. This method has been intended to parse javadoc tags. A more useful solution will be added around the AST node FormalComment, which contains as children JavadocElement nodes, which in turn provide access to the JavadocTag.
        Gets the remaining line after a specific position.
        Parameters:
        text - the complete text
        position - the position from which the comment should be returned
        Returns:
        the part of the text
      • javadocTagsIn

        @Deprecated
        public static java.util.Map<java.lang.String,​java.lang.Integer> javadocTagsIn​(java.lang.String comment)
        Deprecated.
        This method is deprecated and will be removed with PMD 7.0.0. This method has been intended to parse javadoc tags. A more useful solution will be added around the AST node FormalComment, which contains as children JavadocElement nodes, which in turn provide access to the JavadocTag.
        Finds all the javadoc tags in the (formal) comment. Returns a map from javadoc tag to index position.

        Note: If a tag is used multiple times, the last occurrence is returned.

        Parameters:
        comment - the raw comment
        Returns:
        mapping of javadoc tag to index position
      • multiLinesIn

        @Deprecated
        public static java.util.List<java.lang.String> multiLinesIn​(java.lang.String comment)
        Deprecated.
        This method will be removed with PMD 7.0.0. It has been replaced by Comment.getFilteredComment().
        Removes the leading comment marker (like *) of each line of the comment as well as the start marker (//, /* or /** and the end markers (*/).
        Parameters:
        comment - the raw comment
        Returns:
        List of lines of the comments
      • trim

        @Deprecated
        public static java.util.List<java.lang.String> trim​(java.util.List<java.lang.String> lines)
        Deprecated.
        This method will be removed with PMD 7.0.0. It is not needed anymore, since Comment.getFilteredComment() returns already the filtered and trimmed comment text.
        Similar to the String.trim() function, this one removes the leading and trailing empty/blank lines from the line list.
        Parameters:
        lines - the list of lines, which might contain empty lines
        Returns:
        the lines without leading or trailing blank lines.