public final class ReferenceMapper extends java.lang.Object implements IReferenceMapper, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
static ReferenceMapper |
DEFAULT_MAPPER
Passthrough mapper, used as failover
|
static java.lang.String |
DEFAULT_RESOURCE
Resource to attempt to load if no source is specified explicitly
|
| Constructor and Description |
|---|
ReferenceMapper()
Create an empty refmap
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
addMapping(java.lang.String context,
java.lang.String className,
java.lang.String reference,
java.lang.String newReference)
Add a mapping to this refmap
|
java.lang.String |
getContext()
Get the current context
|
java.lang.String |
getResourceName()
Get the resource name this refmap was loaded from (if available).
|
java.lang.String |
getStatus()
Get a user-readable "status" string for this refmap for use in error
messages
|
boolean |
isDefault()
Get whether this mapper is defaulted.
|
static ReferenceMapper |
read(java.io.Reader reader,
java.lang.String name)
Read a new refmap instance from the specified reader
|
static ReferenceMapper |
read(java.lang.String resourcePath)
Read a new refmap from the specified resource
|
java.lang.String |
remap(java.lang.String className,
java.lang.String reference)
Remap a reference for the specified owning class in the current context
|
java.lang.String |
remapWithContext(java.lang.String context,
java.lang.String className,
java.lang.String reference)
Remap a reference for the specified owning class in the specified context
|
void |
setContext(java.lang.String context)
Set the current remap context, can be null
|
void |
write(java.lang.Appendable writer)
Write this refmap out to the specified writer
|
public static final java.lang.String DEFAULT_RESOURCE
public static final ReferenceMapper DEFAULT_MAPPER
public boolean isDefault()
IReferenceMapperDEFAULT_MAPPER because of
classloader shenanigansisDefault in interface IReferenceMapperpublic java.lang.String getResourceName()
IReferenceMappergetResourceName in interface IReferenceMapperpublic java.lang.String getStatus()
IReferenceMappergetStatus in interface IReferenceMapperpublic java.lang.String getContext()
IReferenceMappergetContext in interface IReferenceMapperpublic void setContext(java.lang.String context)
IReferenceMappersetContext in interface IReferenceMappercontext - remap contextpublic java.lang.String remap(java.lang.String className,
java.lang.String reference)
IReferenceMapperremap in interface IReferenceMapperclassName - Owner classreference - Reference to remappublic java.lang.String remapWithContext(java.lang.String context,
java.lang.String className,
java.lang.String reference)
IReferenceMapperremapWithContext in interface IReferenceMappercontext - Remap context to useclassName - Owner classreference - Reference to remappublic java.lang.String addMapping(java.lang.String context,
java.lang.String className,
java.lang.String reference,
java.lang.String newReference)
context - Obfuscation context, can be nullclassName - Class which owns this mapping, cannot be nullreference - Reference to remap, cannot be nullnewReference - Remapped value, cannot be nullMap.put(K, V)public void write(java.lang.Appendable writer)
writer - Writer to write topublic static ReferenceMapper read(java.lang.String resourcePath)
resourcePath - Resource to read fromDEFAULT_MAPPER if reading failspublic static ReferenceMapper read(java.io.Reader reader, java.lang.String name)
reader - Reader to read fromname - Name of the resource being read from