Interface ClassRemapper
- All Superinterfaces:
ClassFileTransform<ClassTransform, ClassElement, ClassBuilder>
,ClassTransform
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:
- 24
-
Field Summary
Fields declared in interface java.lang.classfile.ClassTransform
ACCEPT_ALL
-
Method Summary
Modifier and TypeMethodDescriptionReturns thisClassRemapper
asCodeTransform
instance.Returns thisClassRemapper
asFieldTransform
instance.Returns thisClassRemapper
asMethodTransform
instance.Access method to internal class mapping function.static ClassRemapper
Creates new instance ofClassRemapper
instructed with a map function.static ClassRemapper
Creates new instance ofClassRemapper
instructed 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 declared in interface java.lang.classfile.ClassFileTransform
accept, atEnd, atStart
Methods declared in interface java.lang.classfile.ClassTransform
andThen
-
Method Details
-
of
Creates new instance ofClassRemapper
instructed 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 ofClassRemapper
instructed with a map function. Map function must return validClassDesc
of an interface or a class, even for identity mappings.- Parameters:
mapFunction
- class map function- Returns:
- new instance of
ClassRemapper
-
map
-
asFieldTransform
FieldTransform asFieldTransform()Returns thisClassRemapper
asFieldTransform
instance.- Returns:
- this
ClassRemapper
asFieldTransform
instance
-
asMethodTransform
MethodTransform asMethodTransform()Returns thisClassRemapper
asMethodTransform
instance.- Returns:
- this
ClassRemapper
asMethodTransform
instance
-
asCodeTransform
CodeTransform asCodeTransform()Returns thisClassRemapper
asCodeTransform
instance.- Returns:
- this
ClassRemapper
asCodeTransform
instance
-
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
-