Class GeneratedFilesWriter

java.lang.Object
org.infinispan.protostream.annotations.impl.processor.GeneratedFilesWriter

final class GeneratedFilesWriter extends Object
Tracks generated source files. Also keeps track of which files are 'disabled', ie. generated due to dependency processing, but are not part of current module and do not need to be actually emitted and compiled.
Since:
4.3
  • Field Details

  • Constructor Details

    • GeneratedFilesWriter

      GeneratedFilesWriter(Filer filer)
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public void setEnabled(boolean isEnabled)
    • addMarshallerSourceFile

      public void addMarshallerSourceFile(String className, String source, Element originatingElement) throws IOException
      Throws:
      IOException
    • addInitializerSourceFile

      public void addInitializerSourceFile(String className, String source, Element[] originatingElements) throws IOException
      Throws:
      IOException
    • addSchemaResourceFile

      public void addSchemaResourceFile(String fileName, String source, Element[] originatingElements) throws IOException
      Throws:
      IOException
    • addGeneratedFile

      private void addGeneratedFile(String fqn, GeneratedFilesWriter.GeneratedFile file) throws IOException
      Throws:
      IOException
    • checkResourceFileUpToDate

      private static boolean checkResourceFileUpToDate(Filer filer, String fileName, String contents)
      Checks that a generated resource file exists on disk and the contents matches the expected string.
      Parameters:
      filer - the Filer
      fileName - the file name
      Returns:
      true if the file exists and contents is as expected, false otherwise
    • checkSourceFileUpToDate

      private static boolean checkSourceFileUpToDate(Filer filer, String className, String contents)
      Checks that a generated source file is up to date: it exists on disk, the contents matches the expected string and the corresponding class also exists and its timestamp is newer.
      Parameters:
      filer - the Filer
      className - fully qualified class name
      contents - the expected contents of the source file
      Returns:
      true if the file exists and contents is as expected, false otherwise
    • readUtf8String

      private static String readUtf8String(InputStream is) throws IOException
      Throws:
      IOException