Class FileFormatter

java.lang.Object
org.pgcodekeeper.core.formatter.FileFormatter

public class FileFormatter extends Object
Main formatter class that handles SQL file formatting for different database types. Acts as a facade that delegates to specific database formatter implementations.
  • Constructor Details

    • FileFormatter

      public FileFormatter(String source, int offset, int length, FormatConfiguration config, DatabaseType dbType)
      Constructs a new FileFormatter instance.
      Parameters:
      source - The source SQL text to format
      offset - Starting offset in the source text
      length - Length of text to format
      config - Formatting configuration options
      dbType - Target database type for dialect-specific formatting
  • Method Details

    • formatText

      public String formatText()
      Formats the source text according to configuration and database type.
      Returns:
      Formatted SQL string
    • getFormatItems

      public List<FormatItem> getFormatItems()
      Gets the list of formatting operations that would be applied. This allows inspection of formatting changes without actually modifying the text.
      Returns:
      List of FormatItem objects representing formatting operations