public class Mappings
extends org.objectweb.asm.commons.Remapper
| Modifier and Type | Class and Description |
|---|---|
static class |
Mappings.ReverseCacheMode |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
classMappings
Class names are separated by
/.org/example/SomeClass -> org/example/NewName |
protected java.util.Map<java.lang.String,java.lang.String> |
fieldMappings
Field names are separated by
. from the owner and with : from the descriptor.The descriptor is optional but highly recommended to avoid conflicts. org/example/SomeClass.fieldName:I -> newFieldName |
protected java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> |
mapInitializer |
protected java.util.Map<java.lang.String,java.lang.String> |
methodMappings
Method names are separated by
. from the owner. |
protected java.util.Map<java.lang.String,java.lang.String> |
packageMappings
Package names are separated by
/.If a package equals . it is the default package.org/example -> org/example2 |
| Constructor and Description |
|---|
Mappings() |
Mappings(Mappings mappings,
java.util.function.Function<java.util.Map<java.lang.String,java.lang.String>,java.util.Map<java.lang.String,java.lang.String>> mapCopier) |
Mappings(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer) |
| Modifier and Type | Method and Description |
|---|---|
Mappings |
addClassMapping(java.lang.String from,
java.lang.String to)
Add a class mapping.
org/example/SomeClass -> org/example/NewName |
Mappings |
addClassMapping(java.lang.String from,
java.lang.String to,
boolean skipExisting)
Add a class mapping.
org/example/SomeClass -> org/example/NewName |
Mappings |
addFieldMapping(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
java.lang.String newName)
Add a field mapping.
The descriptor is optional but highly recommended to avoid conflicts. org/example/SomeClass.fieldName:I -> newFieldName |
Mappings |
addFieldMapping(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
java.lang.String newName,
boolean skipExisting)
Add a field mapping.
The descriptor is optional but highly recommended to avoid conflicts. org/example/SomeClass.fieldName:I -> newFieldName |
Mappings |
addMethodMapping(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
java.lang.String newName)
Add a method mapping.
org/example/SomeClass.methodName(I)V -> newMethodName |
Mappings |
addMethodMapping(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
java.lang.String newName,
boolean skipExisting)
Add a method mapping.
org/example/SomeClass.methodName(I)V -> newMethodName |
Mappings |
addPackageMapping(java.lang.String from,
java.lang.String to)
Add a package mapping.
If a package is . it is the default package.org/example -> org/example2 |
Mappings |
addPackageMapping(java.lang.String from,
java.lang.String to,
boolean skipExisting)
Add a package mapping.
If a package is . it is the default package.org/example -> org/example2 |
Mappings |
copy() |
Mappings |
copy(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer)
Get a copy of these mappings with a custom map initializer.
This should be overridden by subclasses to return the correct type. |
Mappings |
emptyCopy() |
Mappings |
emptyCopy(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer)
Get an empty copy of these mappings with a custom map initializer.
This should be overridden by subclasses to return the correct type. |
java.util.Map<java.lang.String,java.lang.String> |
getClassMappings() |
java.util.Map<java.lang.String,java.lang.String> |
getFieldMappings() |
java.util.Map<java.lang.String,java.lang.String> |
getMethodMappings() |
java.util.Map<java.lang.String,java.lang.String> |
getPackageMappings() |
boolean |
isEmpty() |
Mappings |
isolate()
Isolate this instance from the reversed one.
This will remove the reverse reference from this instance and the reverse instance. |
java.lang.String |
map(java.lang.String internalName) |
java.lang.String |
mapClassPackage(java.lang.String internalName)
Map the package of a class name.
|
java.lang.String |
mapFieldName(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
java.lang.String |
mapMethodName(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
java.lang.String |
mapPackageName(java.lang.String name) |
Mappings |
reverse()
Reverse the mappings using the
Mappings.ReverseCacheMode.UPDATE mode. |
Mappings |
reverse(Mappings.ReverseCacheMode mode)
Reverse the mappings using the given mode.
If the reverse mappings are already cached with the given mode, they will be returned. Reversing the mappings is an expensive operation and should be cached if used multiple times. |
int |
size() |
java.lang.String |
toString() |
createRemappingSignatureAdapter, createSignatureRemapper, mapAnnotationAttributeName, mapBasicInvokeDynamicMethodName, mapDesc, mapInnerClassName, mapInvokeDynamicMethodName, mapInvokeDynamicMethodName, mapMethodDesc, mapModuleName, mapRecordComponentName, mapSignature, mapType, mapTypes, mapValue, mapWellKnownInvokeDynamicMethodNameprotected final java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer
protected final java.util.Map<java.lang.String,java.lang.String> packageMappings
/.. it is the default package.org/example -> org/example2protected final java.util.Map<java.lang.String,java.lang.String> classMappings
/.org/example/SomeClass -> org/example/NewNameprotected final java.util.Map<java.lang.String,java.lang.String> fieldMappings
. from the owner and with : from the descriptor.org/example/SomeClass.fieldName:I -> newFieldNameprotected final java.util.Map<java.lang.String,java.lang.String> methodMappings
. from the owner. The descriptor is directly appended to the name.org/example/SomeClass.methodName(I)V -> newMethodNamepublic Mappings()
public Mappings(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer)
public Mappings(Mappings mappings, java.util.function.Function<java.util.Map<java.lang.String,java.lang.String>,java.util.Map<java.lang.String,java.lang.String>> mapCopier)
public java.util.Map<java.lang.String,java.lang.String> getPackageMappings()
public Mappings addPackageMapping(java.lang.String from, java.lang.String to)
. it is the default package.org/example -> org/example2from - The source packageto - The mapped packageaddPackageMapping(String, String, boolean)public Mappings addPackageMapping(java.lang.String from, java.lang.String to, boolean skipExisting)
. it is the default package.org/example -> org/example2from - The source packageto - The mapped packageskipExisting - If the mapping should be skipped if it already existspublic java.lang.String mapPackageName(java.lang.String name)
mapPackageName in class org.objectweb.asm.commons.Remapperpublic java.lang.String mapClassPackage(java.lang.String internalName)
internalName - The internal name of the classpublic java.util.Map<java.lang.String,java.lang.String> getClassMappings()
public Mappings addClassMapping(java.lang.String from, java.lang.String to)
org/example/SomeClass -> org/example/NewNamefrom - The source classto - The mapped classpublic Mappings addClassMapping(java.lang.String from, java.lang.String to, boolean skipExisting)
org/example/SomeClass -> org/example/NewNamefrom - The source classto - The mapped classskipExisting - If the mapping should be skipped if it already exists@Nonnull public java.lang.String map(java.lang.String internalName)
map in class org.objectweb.asm.commons.Remapperpublic java.util.Map<java.lang.String,java.lang.String> getFieldMappings()
public Mappings addFieldMapping(java.lang.String owner, java.lang.String name, @Nullable java.lang.String descriptor, java.lang.String newName)
org/example/SomeClass.fieldName:I -> newFieldNameowner - The owner of the fieldname - The name of the fielddescriptor - The descriptor of the fieldnewName - The new name of the fieldaddFieldMapping(String, String, String, String, boolean)public Mappings addFieldMapping(java.lang.String owner, java.lang.String name, @Nullable java.lang.String descriptor, java.lang.String newName, boolean skipExisting)
org/example/SomeClass.fieldName:I -> newFieldNameowner - The owner of the fieldname - The name of the fielddescriptor - The descriptor of the fieldnewName - The new name of the fieldskipExisting - If the mapping should be skipped if it already existspublic java.lang.String mapFieldName(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
mapFieldName in class org.objectweb.asm.commons.Remapperpublic java.util.Map<java.lang.String,java.lang.String> getMethodMappings()
public Mappings addMethodMapping(java.lang.String owner, java.lang.String name, java.lang.String descriptor, java.lang.String newName)
org/example/SomeClass.methodName(I)V -> newMethodNameowner - The owner of the methodname - The name of the methoddescriptor - The descriptor of the methodnewName - The new name of the methodaddMethodMapping(String, String, String, String, boolean)public Mappings addMethodMapping(java.lang.String owner, java.lang.String name, java.lang.String descriptor, java.lang.String newName, boolean skipExisting)
org/example/SomeClass.methodName(I)V -> newMethodNameowner - The owner of the methodname - The name of the methoddescriptor - The descriptor of the methodnewName - The new name of the methodskipExisting - If the mapping should be skipped if it already existspublic java.lang.String mapMethodName(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
mapMethodName in class org.objectweb.asm.commons.Remapperpublic int size()
public boolean isEmpty()
public Mappings emptyCopy()
public Mappings emptyCopy(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer)
mapInitializer - The map initializerpublic Mappings copy()
public Mappings copy(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.String>> mapInitializer)
mapInitializer - The map initializerpublic Mappings isolate()
public Mappings reverse()
Mappings.ReverseCacheMode.UPDATE mode.public Mappings reverse(Mappings.ReverseCacheMode mode)
mode - The mode to usepublic java.lang.String toString()
toString in class java.lang.Object