Class GeneratedFilesWriter
java.lang.Object
org.infinispan.protostream.annotations.impl.processor.GeneratedFilesWriter
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Filerprivate final Map<String, GeneratedFilesWriter.GeneratedFile> private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidaddInitializerSourceFile(String className, String source, Element[] originatingElements) voidaddMarshallerSourceFile(String className, String source, Element originatingElement) voidaddSchemaResourceFile(String fileName, String source, Element[] originatingElements) private static booleancheckResourceFileUpToDate(Filer filer, String fileName, String contents) Checks that a generated resource file exists on disk and the contents matches the expected string.private static booleancheckSourceFileUpToDate(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.booleanprivate static StringvoidsetEnabled(boolean isEnabled)
-
Field Details
-
generatedFiles
-
filer
-
isEnabled
private boolean isEnabled
-
-
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
Checks that a generated resource file exists on disk and the contents matches the expected string.- Parameters:
filer- the FilerfileName- the file name- Returns:
trueif the file exists and contents is as expected,falseotherwise
-
checkSourceFileUpToDate
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 FilerclassName- fully qualified class namecontents- the expected contents of the source file- Returns:
trueif the file exists and contents is as expected,falseotherwise
-
readUtf8String
- Throws:
IOException
-