- All Superinterfaces:
ClassFileTransform<ClassTransform,,ClassElement, ClassBuilder> ClassTransform
- All Known Implementing Classes:
ClassRemapperImpl
ClassRemapper is a ClassTransform, FieldTransform,
MethodTransform and CodeTransform
deeply re-mapping all class references in any form, according to given map or
map function.
The re-mapping is applied to superclass, interfaces, all kinds of descriptors and signatures, all attributes referencing classes in any form (including all types of annotations), and to all instructions referencing to classes.
Primitive types and arrays are never subjects of mapping and are not allowed targets of mapping.
Arrays of reference types are always decomposed, mapped as the base reference types and composed back to arrays.
- Since:
- 22
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.glavo.classfile.ClassFileTransform
ClassFileTransform.ResolvedTransform<E extends ClassFileElement> -
Field Summary
Fields inherited from interface org.glavo.classfile.ClassTransform
ACCEPT_ALL -
Method Summary
Modifier and TypeMethodDescriptionReturns thisClassRemapperasCodeTransforminstance.Returns thisClassRemapperasFieldTransforminstance.Returns thisClassRemapperasMethodTransforminstance.Access method to internal class mapping function.static ClassRemapperCreates new instance ofClassRemapperinstructed with a map function.static ClassRemapperCreates new instance ofClassRemapperinstructed with a class map.default byte[]remapClass(ClassFile context, ClassModel clm) Remaps the whole ClassModel into a new class file, including the class name.Methods inherited from interface org.glavo.classfile.ClassFileTransform
accept, atEnd, atStartMethods inherited from interface org.glavo.classfile.ClassTransform
andThen, resolve
-
Method Details
-
of
Creates new instance ofClassRemapperinstructed with a class map. Map may contain only re-mapping entries, identity mapping is applied by default.- Parameters:
classMap- class map- Returns:
- new instance of
ClassRemapper
-
of
Creates new instance ofClassRemapperinstructed with a map function. Map function must return validClassDescof an interface or a class, even for identity mappings.- Parameters:
mapFunction- class map function- Returns:
- new instance of
ClassRemapper
-
map
Access method to internal class mapping function.- Parameters:
desc- source class- Returns:
- target class
-
asFieldTransform
FieldTransform asFieldTransform()Returns thisClassRemapperasFieldTransforminstance.- Returns:
- this
ClassRemapperasFieldTransforminstance
-
asMethodTransform
MethodTransform asMethodTransform()Returns thisClassRemapperasMethodTransforminstance.- Returns:
- this
ClassRemapperasMethodTransforminstance
-
asCodeTransform
CodeTransform asCodeTransform()Returns thisClassRemapperasCodeTransforminstance.- Returns:
- this
ClassRemapperasCodeTransforminstance
-
remapClass
Remaps the whole ClassModel into a new class file, including the class name.- Parameters:
context- ClassFile contextclm- class model to re-map- Returns:
- re-mapped class file bytes
-