java.lang.Object
io.github.sugarcubes.cloner.enhancement.ClassMasks
Classes which get copy constructors, listed by masks in the resources "META-INF/sugar-cubes-cloner/copy-constructors": a project lists its own
classes, the build tools add copy constructors to them at build time, the cloner agent when they are loaded.
The resource is a text file in UTF-8, one mask per line, # starts a comment. Masks have the syntax of
ProGuard/R8 class filters: ? - any character but a dot, * - any characters but dots,
** - any characters, ! before a mask - exclusion. A binary class name matches if it matches some
mask and no exclusion.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClassMasksMatches nothing.static final StringName of the resources with the masks. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTells whether the name matches some mask and no exclusion.static ClassMasksof(Collection<String> masks) Creates the filter from masks.Reads the masks of a resource.static ClassMasksread(ClassLoader loader) Reads the masks of all resources "META-INF/sugar-cubes-cloner/copy-constructors" which the class loader finds.
-
Field Details
-
RESOURCE
Name of the resources with the masks.- See Also:
-
NONE
Matches nothing.
-
-
Method Details
-
of
Creates the filter from masks.- Parameters:
masks- masks, exclusions start with!- Returns:
- filter
- Throws:
IllegalArgumentException- if a mask is invalid
-
read
Reads the masks of all resources "META-INF/sugar-cubes-cloner/copy-constructors" which the class loader finds.- Parameters:
loader- class loader- Returns:
- masks,
NONEif there are no resources - Throws:
UncheckedIOException- if a resource cannot be readIllegalArgumentException- if a mask is invalid
-
parse
Reads the masks of a resource.- Parameters:
resource- resource- Returns:
- masks, without comments and empty lines
- Throws:
IOException- if the resource cannot be read
-
matches
Tells whether the name matches some mask and no exclusion.- Parameters:
className- binary class name- Returns:
trueif the name matches
-