- All Superinterfaces:
ClassFileTransformPREVIEW<ClassTransformPREVIEW,
,ClassElementPREVIEW, ClassBuilderPREVIEW> ClassTransformPREVIEW
ClassRemapper
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
ClassRemapper
is a ClassTransform
PREVIEW, FieldTransform
PREVIEW,
MethodTransform
PREVIEW and CodeTransform
PREVIEW
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 declared in interface java.lang.classfile.ClassFileTransformPREVIEW
ClassFileTransform.ResolvedTransformPREVIEW<E extends ClassFileElementPREVIEW>
-
Field Summary
Fields declared in interface java.lang.classfile.ClassTransformPREVIEW
ACCEPT_ALL
-
Method Summary
Modifier and TypeMethodDescriptionAccess method to internal class mapping function.static ClassRemapperPREVIEW
Creates new instance ofClassRemapper
instructed with a map function.static ClassRemapperPREVIEW
Creates new instance ofClassRemapper
instructed with a class map.default byte[]
remapClass
(ClassFilePREVIEW context, ClassModelPREVIEW clm) Remaps the whole ClassModel into a new class file, including the class name.Methods declared in interface java.lang.classfile.ClassFileTransformPREVIEW
accept, atEnd, atStart
Methods declared in interface java.lang.classfile.ClassTransformPREVIEW
andThen, resolve
-
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
FieldTransformPREVIEW asFieldTransform()- Returns:
- this
ClassRemapper
asFieldTransform
PREVIEW instance
-
asMethodTransform
MethodTransformPREVIEW asMethodTransform()- Returns:
- this
ClassRemapper
asMethodTransform
PREVIEW instance
-
asCodeTransform
CodeTransformPREVIEW asCodeTransform()- Returns:
- this
ClassRemapper
asCodeTransform
PREVIEW 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
-
ClassRemapper
when preview features are enabled.