Top Description Constructors Methods
net.bytebuddy.jar.asm.commons

public abstract Class Remapper

extends Object
Class Inheritance
Known Direct Subclasses
net.bytebuddy.jar.asm.commons.SimpleRemapper, net.bytebuddy.build.RenamingPlugin.RenamingRemapper
Imports
net.bytebuddy.jar.asm.ConstantDynamic, .Handle, .Opcodes, .Type, net.bytebuddy.jar.asm.signature.SignatureReader, .SignatureVisitor, .SignatureWriter

A class responsible for remapping types and names.
Author
Eugene Kuleshov

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected SignatureVisitor

Returns:

the newly created remapper.
createRemappingSignatureAdapter
(final SignatureVisitor
the SignatureVisitor the remapper must delegate to.
signatureVisitor
)

Deprecated use createSignatureRemapper instead.
Constructs a new remapper for signatures.
protected SignatureVisitor

Returns:

the newly created remapper.
createSignatureRemapper
(final SignatureVisitor
the SignatureVisitor the remapper must delegate to.
signatureVisitor
)

Constructs a new remapper for signatures.

public String

Returns:

the new internal name (see Type#getInternalName()).
map
(final String
the internal name of a class (see Type#getInternalName()).
internalName
)

Maps the internal name of a class to its new name.

public String

Returns:

the new name of the annotation attribute.
mapAnnotationAttributeName
(final String
the descriptor of the annotation class.
descriptor
,
final String
the name of the annotation attribute.
name
)

Maps an annotation attribute name.

public String

Returns:

the given descriptor, with its [array element type] internal name remapped with map(String) (if the descriptor corresponds to an array or object type, otherwise the descriptor is returned as is). See Type#getInternalName().
mapDesc
(final String
a type descriptor.
descriptor
)

Returns the given descriptor, remapped with map(String).

public String

Returns:

the new name of the field.
mapFieldName
(final String
the internal name of the owner class of the field (see Type#getInternalName()).
owner
,
final String
the name of the field.
name
,
final String
the descriptor of the field.
descriptor
)

Maps a field name to its new name.

public String

Returns:

the new inner name of the inner class.
mapInnerClassName
(final String
the fully-qualified internal name of the inner class (see Type#getInternalName()).
name
,
final String
the internal name of the owner class of the inner class (see Type#getInternalName()).
ownerName
,
final String
the internal name of the inner class (see Type#getInternalName()).
innerName
)

Maps an inner class name to its new name.

public String

Returns:

the new name of the method.
mapInvokeDynamicMethodName
(final String
the name of the method.
name
,
final String
the descriptor of the method.
descriptor
)

Maps an invokedynamic or a constant dynamic method name to its new name.

public String

Returns:

the given method descriptor, with its argument and return type descriptors remapped with mapDesc(String).
mapMethodDesc
(final String
a method descriptor.
methodDescriptor
)

Returns the given method descriptor, with its argument and return type descriptors remapped with mapDesc(String).

public String

Returns:

the new name of the method.
mapMethodName
(final String
the internal name of the owner class of the method (see Type#getInternalName()).
owner
,
final String
the name of the method.
name
,
final String
the descriptor of the method.
descriptor
)

Maps a method name to its new name.

public String

Returns:

the new name of the module.
mapModuleName
(final String
the fully qualified name (using dots) of a module.
name
)

Maps a module name to its new name.

public String

Returns:

the new name of the package.
mapPackageName
(final String
the fully qualified name of the package (using dots).
name
)

Maps a package name to its new name.

public String

Returns:

the new name of the field.
mapRecordComponentName
(final String
the internal name of the owner class of the field (see Type#getInternalName()).
owner
,
final String
the name of the field.
name
,
final String
the descriptor of the field.
descriptor
)

Maps a record component name to its new name.

public String

Returns:

signature the given signature, remapped with the SignatureVisitor returned by createSignatureRemapper(SignatureVisitor).
mapSignature
(final String
a JavaTypeSignature, ClassSignature or MethodSignature.
signature
,
final boolean
whether the given signature is a JavaTypeSignature.
typeSignature
)

Returns the given signature, remapped with the SignatureVisitor returned by createSignatureRemapper(SignatureVisitor).

private Type

Returns:

the given type, with its [array element type] internal name remapped with map(String) (if the type is an array or object type, otherwise the type is returned as is) or, of the type is a method type, with its descriptor remapped with mapMethodDesc(String). See Type#getInternalName().
mapType
(final Type
a type, which can be a method type.
type
)

Returns the given Type, remapped with map(String) or mapMethodDesc(String).

public String

Returns:

the given internal name, remapped with map(String) (see Type#getInternalName()).
mapType
(final String
the internal name (or array type descriptor) of some (array) class (see Type#getInternalName()).
internalName
)

Returns the given internal name, remapped with map(String).

public String[]

Returns:

the given internal name, remapped with map(String) (see Type#getInternalName()).
mapTypes
(final String[]
the internal names (or array type descriptors) of some (array) classes (see Type#getInternalName()).
internalNames
)

Returns the given internal names, remapped with map(String).

public Object

Returns:

the given value, remapped with this remapper.
mapValue
(final Object
an object. Only Type, Handle and ConstantDynamic values are remapped.
value
)

Returns the given value, remapped with this remapper.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Remapperback to summary
public Remapper()

Method Detail

createRemappingSignatureAdapterback to summary
protected SignatureVisitor createRemappingSignatureAdapter(final SignatureVisitor signatureVisitor)

Deprecated

use createSignatureRemapper instead.

Constructs a new remapper for signatures. The default implementation of this method returns a new SignatureRemapper.

Parameters
signatureVisitor:SignatureVisitor

the SignatureVisitor the remapper must delegate to.

Returns:SignatureVisitor

the newly created remapper.

Annotations
@Deprecated
createSignatureRemapperback to summary
protected SignatureVisitor createSignatureRemapper(final SignatureVisitor signatureVisitor)

Constructs a new remapper for signatures. The default implementation of this method returns a new SignatureRemapper.

Parameters
signatureVisitor:SignatureVisitor

the SignatureVisitor the remapper must delegate to.

Returns:SignatureVisitor

the newly created remapper.

mapback to summary
public String map(final String internalName)

Maps the internal name of a class to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
internalName:String

the internal name of a class (see Type#getInternalName()).

Returns:String

the new internal name (see Type#getInternalName()).

mapAnnotationAttributeNameback to summary
public String mapAnnotationAttributeName(final String descriptor, final String name)

Maps an annotation attribute name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
descriptor:String

the descriptor of the annotation class.

name:String

the name of the annotation attribute.

Returns:String

the new name of the annotation attribute.

mapDescback to summary
public String mapDesc(final String descriptor)

Returns the given descriptor, remapped with map(String).

Parameters
descriptor:String

a type descriptor.

Returns:String

the given descriptor, with its [array element type] internal name remapped with map(String) (if the descriptor corresponds to an array or object type, otherwise the descriptor is returned as is). See Type#getInternalName().

mapFieldNameback to summary
public String mapFieldName(final String owner, final String name, final String descriptor)

Maps a field name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
owner:String

the internal name of the owner class of the field (see Type#getInternalName()).

name:String

the name of the field.

descriptor:String

the descriptor of the field.

Returns:String

the new name of the field.

mapInnerClassNameback to summary
public String mapInnerClassName(final String name, final String ownerName, final String innerName)

Maps an inner class name to its new name. The default implementation of this method provides a strategy that will work for inner classes produced by Java, but not necessarily other languages. Subclasses can override.

Parameters
name:String

the fully-qualified internal name of the inner class (see Type#getInternalName()).

ownerName:String

the internal name of the owner class of the inner class (see Type#getInternalName()).

innerName:String

the internal name of the inner class (see Type#getInternalName()).

Returns:String

the new inner name of the inner class.

mapInvokeDynamicMethodNameback to summary
public String mapInvokeDynamicMethodName(final String name, final String descriptor)

Maps an invokedynamic or a constant dynamic method name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
name:String

the name of the method.

descriptor:String

the descriptor of the method.

Returns:String

the new name of the method.

mapMethodDescback to summary
public String mapMethodDesc(final String methodDescriptor)

Returns the given method descriptor, with its argument and return type descriptors remapped with mapDesc(String).

Parameters
methodDescriptor:String

a method descriptor.

Returns:String

the given method descriptor, with its argument and return type descriptors remapped with mapDesc(String).

mapMethodNameback to summary
public String mapMethodName(final String owner, final String name, final String descriptor)

Maps a method name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
owner:String

the internal name of the owner class of the method (see Type#getInternalName()).

name:String

the name of the method.

descriptor:String

the descriptor of the method.

Returns:String

the new name of the method.

mapModuleNameback to summary
public String mapModuleName(final String name)

Maps a module name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
name:String

the fully qualified name (using dots) of a module.

Returns:String

the new name of the module.

mapPackageNameback to summary
public String mapPackageName(final String name)

Maps a package name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
name:String

the fully qualified name of the package (using dots).

Returns:String

the new name of the package.

mapRecordComponentNameback to summary
public String mapRecordComponentName(final String owner, final String name, final String descriptor)

Maps a record component name to its new name. The default implementation of this method returns the given name, unchanged. Subclasses can override.

Parameters
owner:String

the internal name of the owner class of the field (see Type#getInternalName()).

name:String

the name of the field.

descriptor:String

the descriptor of the field.

Returns:String

the new name of the field.

mapSignatureback to summary
public String mapSignature(final String signature, final boolean typeSignature)

Returns the given signature, remapped with the SignatureVisitor returned by createSignatureRemapper(SignatureVisitor).

Parameters
signature:String

a JavaTypeSignature, ClassSignature or MethodSignature.

typeSignature:boolean

whether the given signature is a JavaTypeSignature.

Returns:String

signature the given signature, remapped with the SignatureVisitor returned by createSignatureRemapper(SignatureVisitor).

mapTypeback to summary
private Type mapType(final Type type)

Returns the given Type, remapped with map(String) or mapMethodDesc(String).

Parameters
type:Type

a type, which can be a method type.

Returns:Type

the given type, with its [array element type] internal name remapped with map(String) (if the type is an array or object type, otherwise the type is returned as is) or, of the type is a method type, with its descriptor remapped with mapMethodDesc(String). See Type#getInternalName().

mapTypeback to summary
public String mapType(final String internalName)

Returns the given internal name, remapped with map(String).

Parameters
internalName:String

the internal name (or array type descriptor) of some (array) class (see Type#getInternalName()).

Returns:String

the given internal name, remapped with map(String) (see Type#getInternalName()).

mapTypesback to summary
public String[] mapTypes(final String[] internalNames)

Returns the given internal names, remapped with map(String).

Parameters
internalNames:String[]

the internal names (or array type descriptors) of some (array) classes (see Type#getInternalName()).

Returns:String[]

the given internal name, remapped with map(String) (see Type#getInternalName()).

mapValueback to summary
public Object mapValue(final Object value)

Returns the given value, remapped with this remapper. Possible values are Boolean, Byte, Short, Character, Integer, Long, Double, Float, String, Type, Handle, ConstantDynamic or arrays of primitive types .

Parameters
value:Object

an object. Only Type, Handle and ConstantDynamic values are remapped.

Returns:Object

the given value, remapped with this remapper.