java.lang.Object
com.puppycrawl.tools.checkstyle.checks.javadoc.utils.InlineTagUtil

public final class InlineTagUtil extends Object
Tools for extracting inline tags from Javadoc comments.
  • Field Details

  • Constructor Details

  • Method Details

    • extractInlineTags

      public static List<TagInfo> extractInlineTags(String... lines)
      Extract inline Javadoc tags from the given comment.
      Parameters:
      lines - The Javadoc comment (as lines).
      Returns:
      The extracted inline Javadoc tags.
      Throws:
      IllegalArgumentException - when comment lines contain newlines
    • convertLinesToString

      private static String convertLinesToString(String... lines)
      Convert array of string to single String.
      Parameters:
      lines - A number of lines, in order.
      Returns:
      The lines, joined together with newlines, as a single string.
    • getLineColumnOfIndex

      private static LineColumn getLineColumnOfIndex(String source, int index)
      Get LineColumn from string till index.
      Parameters:
      source - Source string.
      index - An index into the string.
      Returns:
      A position in the source representing what line and column that index appears on.
    • collapseWhitespace

      private static String collapseWhitespace(String str)
      Collapse whitespaces.
      Parameters:
      str - Source string.
      Returns:
      The given string with all whitespace collapsed.
    • removeLeadingJavaDoc

      private static String removeLeadingJavaDoc(String source)
      Remove leading JavaDoc.
      Parameters:
      source - A string to remove leading Javadoc from.
      Returns:
      The given string with leading Javadoc "*" characters from each line removed.