Class ApiUtil

java.lang.Object
com.puppycrawl.tools.checkstyle.api.ApiUtil

final class ApiUtil extends Object
Stateless helpers for API classes that historically contain implementation code. These helpers can be removed together with that implementation in a future API redesign.
  • Constructor Details

    • ApiUtil

      private ApiUtil()
      Private constructor for ApiUtil.
  • Method Details

    • matchesFileExtension

      static boolean matchesFileExtension(File file, String... fileExtensions)
      Returns whether the file extension matches what we are meant to process.
      Parameters:
      file - the file to be checked.
      fileExtensions - file extensions normalized by AbstractFileSetCheck.setFileExtensions(String...); null or empty arrays match all files.
      Returns:
      whether there is a match.
    • lengthExpandedTabs

      static int lengthExpandedTabs(String inputString, int toIdx, int tabWidth)
      Returns the length of a String prefix with tabs expanded. Each tab is counted as the number of characters is takes to jump to the next tab stop.
      Parameters:
      inputString - the input String
      toIdx - index in string (exclusive) where the calculation stops
      tabWidth - the distance between tab stop position.
      Returns:
      the length of string.substring(0, toIdx) with tabs expanded.