Package com.ultikits.ultitools.utils
Class PluginYmlReader
java.lang.Object
com.ultikits.ultitools.utils.PluginYmlReader
Reads a module's own
plugin.yml straight from its class's code source, given only a
bare Class<?> - before any UltiToolsPlugin instance exists (D-12). This is the
third place in the codebase that would otherwise open a JAR to read plugin.yml;
extracting it once here is the point.
Every failure path - null code source, a directory code source with no plugin.yml
(the common case for test/dev classpaths), a missing JAR entry, an unreadable archive, or
malformed YAML - returns PluginYmlReader.PluginYmlInfo.EMPTY rather than throwing, logging at most one
WARNING. This class runs once per plugin class during dependency-graph construction, and a
single bad archive must not take the whole graph down (T-04-20).
- Since:
- 6.3.0
- Author:
- wisdomme
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe subset of a module'splugin.ymlthis framework's dependency graph needs: its declaredname:(nullable - absent when the archive has none or reading failed) and itsloadAfter:list (never null; empty when absent or reading failed). -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static PluginYmlReader.PluginYmlInfoparse(InputStream inputStream) Readsplugin.ymlfor the given class's own code source.private static PluginYmlReader.PluginYmlInforeadFromDirectory(File directory) private static PluginYmlReader.PluginYmlInforeadFromJar(URL jarLocation) private static File
-
Field Details
-
LOGGER
-
PLUGIN_YML_ENTRY
- See Also:
-
-
Constructor Details
-
PluginYmlReader
private PluginYmlReader()
-
-
Method Details
-
read
Readsplugin.ymlfor the given class's own code source.- Parameters:
pluginClass- the class whose containing JAR (or classes directory) should be read; may benull- Returns:
- the module's declared name and
loadAfterlist, orPluginYmlReader.PluginYmlInfo.EMPTYon any failure path - Since:
- 6.3.0
-
toFile
-
readFromDirectory
-
readFromJar
-
parse
-