Class PluginDataProvider
java.lang.Object
net.regsirius06.engine.plugins.files.PluginDataProvider
A utility class responsible for generating files that contain information
about classes annotated with
ImplementationOf. The generated files
are placed in the META-INF/services directory, following the ServiceLoader pattern.
This class scans the provided root directory for annotated classes and generates the appropriate service files. These files are used to load plugins during runtime.
It handles both file creation and writing, ensuring that the necessary directories and files are present and up to date.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCustomIOExceptionsubclass with an additional comment to provide context about the error. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.LoggerLogger instance for logging important events and error messages. -
Method Summary
Modifier and TypeMethodDescriptionvoidScans for classes annotated withImplementationOfand generates service files in the META-INF/services directory.protected static voidFinal message after file generation is completed.static @NotNull PluginDataProviderCreates a new instance ofPluginDataProviderwith the specified root directory.
-
Field Details
-
log
public static final org.slf4j.Logger logLogger instance for logging important events and error messages.Uses SLF4J to provide logging functionality. Messages include information about file generation progress, errors encountered, and successful operations.
-
-
Method Details
-
of
@Contract(value="_ -> new", pure=true) @NotNull public static @NotNull PluginDataProvider of(String root) Creates a new instance ofPluginDataProviderwith the specified root directory.- Parameters:
root- the root directory to scan for classes- Returns:
- a new
PluginDataProviderinstance
-
createDataFiles
public void createDataFiles()Scans for classes annotated withImplementationOfand generates service files in the META-INF/services directory.This method ensures that all necessary directories are created and any existing files are properly cleared and updated with the new class names.
-
finishMessage
protected static void finishMessage()Final message after file generation is completed.
-