Class DescriptorScanner
-
- All Implemented Interfaces:
-
de.griefed.serverpackcreator.api.modscanning.ModJarScanner
public abstract class DescriptorScanner implements ModJarScanner
Base for scanners that read one descriptor file out of each jar, owning the part every one of them shares: walk the jars, and turn any failure on a single jar into that jar's default ScannedMod instead of letting it abort the scan.
Subclasses implement read for one jar and may simply throw — which is why scan is
final. The total-result contract of ModJarScanner is the one thing no scanner may get wrong, and putting it here means it cannot drift between the five implementations that used to each hold a copy.
-
-
Field Summary
Fields Modifier and Type Field Description private final StringscanAnnouncement
-
Constructor Summary
Constructors Constructor Description DescriptorScanner()
-
Method Summary
Modifier and Type Method Description StringgetScanAnnouncement()abstract ScannedModread(File modJar)Read a single jar's descriptor into the verdict for that mod. final List<ScannedMod>scan(Collection<File> jarFiles)Read every jar in jarFiles and report what each declared. -
-
Method Detail
-
getScanAnnouncement
String getScanAnnouncement()
-
read
abstract ScannedMod read(File modJar)
Read a single jar's descriptor into the verdict for that mod.
Implementations are free to throw: scan catches everything and falls back to the defaults, so there is no need to guard the jar-level failure modes here. It is public because the distinction between what it throws is meaningful — MissingDescriptorException means the jar simply belongs to another loader, anything else means the jar could not be read — and that distinction is only observable here; scan deliberately flattens both to a default entry.
-
scan
final List<ScannedMod> scan(Collection<File> jarFiles)
Read every jar in jarFiles and report what each declared.
- Returns:
One entry per input jar, in input order — never fewer, whatever a jar contained.
-
-
-
-