Class XmlMetaWriter

java.lang.Object
com.puppycrawl.tools.checkstyle.meta.XmlMetaWriter

public final class XmlMetaWriter extends Object
Class to write module details object into an XML file.
  • Field Details

    • FILEPATH_CONVERSION

      private static final Pattern FILEPATH_CONVERSION
      Compiled pattern for . used for generating file paths from package names.
    • XML_TAG_NAME

      private static final String XML_TAG_NAME
      Name tag of metadata XML files.
      See Also:
    • XML_TAG_DESCRIPTION

      private static final String XML_TAG_DESCRIPTION
      Description tag of metadata XML files.
      See Also:
    • DEFAULT_FILE_SEPARATOR

      private static final String DEFAULT_FILE_SEPARATOR
      Default(UNIX) file separator.
      See Also:
  • Constructor Details

    • XmlMetaWriter

      private XmlMetaWriter()
      Do no allow XmlMetaWriter instances to be created.
  • Method Details

    • write

      public static void write(ModuleDetails moduleDetails) throws TransformerException, ParserConfigurationException
      Helper function to write module details to XML file.
      Parameters:
      moduleDetails - module details
      Throws:
      TransformerException - if a transformer exception occurs
      ParserConfigurationException - if a parser configuration exception occurs
    • createPropertySection

      private static void createPropertySection(ModuleDetails moduleDetails, Element checkModule, Document doc)
      Create the property section of the module detail object.
      Parameters:
      moduleDetails - module details
      checkModule - root doc element
      doc - document object
    • writeToFile

      private static void writeToFile(Document document, ModuleDetails moduleDetails) throws TransformerException
      Function to write the prepared document object into an XML file.
      Parameters:
      document - document updated with all module metadata
      moduleDetails - the corresponding module details object
      Throws:
      TransformerException - if a transformer exception occurs