diff options
author | zaaarf <zaaarf@proton.me> | 2023-08-26 23:20:06 +0200 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-08-26 23:20:06 +0200 |
commit | 6ec42321a36bb44f71ca27a52c774a8dee21ef08 (patch) | |
tree | 88a10ae36e82be9b75e865026c4bdb8d9440f7d7 /src/main/java/ftbsc/lll/mapper/IMapper.java | |
parent | 27ff8340f3435459ee21babaceef22f59b7a84f6 (diff) |
feat: heavily reworked api to provide data instead of names
Diffstat (limited to 'src/main/java/ftbsc/lll/mapper/IMapper.java')
-rw-r--r-- | src/main/java/ftbsc/lll/mapper/IMapper.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/main/java/ftbsc/lll/mapper/IMapper.java b/src/main/java/ftbsc/lll/mapper/IMapper.java index 96b5d6f..1fe04ca 100644 --- a/src/main/java/ftbsc/lll/mapper/IMapper.java +++ b/src/main/java/ftbsc/lll/mapper/IMapper.java @@ -2,11 +2,14 @@ package ftbsc.lll.mapper; import ftbsc.lll.exceptions.MalformedMappingsException; import ftbsc.lll.exceptions.MappingNotFoundException; +import ftbsc.lll.mapper.tools.data.ClassData; +import ftbsc.lll.mapper.tools.data.FieldData; +import ftbsc.lll.mapper.tools.data.MethodData; import java.util.*; /** - * A generic obfuscation mapper. + * The shared interface between all mappers. */ public interface IMapper { /** @@ -37,44 +40,41 @@ public interface IMapper { void populate(List<String> lines, boolean ignoreErrors) throws MalformedMappingsException; /** + * Builds an {@link IMapper} that functions in reverse to this one (i.e. one that + * considers as "mapped" what this one considers plain, and vice versa). + * @return the inverted mapper + */ + IMapper getInverted(); + + /** * Completely resets the mapper, clearing it of all existing mappings. */ void reset(); /** - * Gets the obfuscated name of the class. + * Gets the {@link ClassData} * @param name the plain internal name of the desired class * @return the obfuscated name of the class * @throws MappingNotFoundException if no mapping is found */ - String obfuscateClass(String name) throws MappingNotFoundException; - - /** - * Gets the plain name of the class. - * @param nameObf the obfuscated internal name of the desired class - * @return the plain name of the class - * @throws MappingNotFoundException if no mapping is found - */ - String deobfuscateClass(String nameObf) throws MappingNotFoundException; + ClassData getClassData(String name) throws MappingNotFoundException; /** * Gets the obfuscated name of a class member (field or method). - * @param parentName the plain internal name of the parent class - * @param memberName the field name or method signature - * @param methodDescriptor the descriptor of the member (only for methods) + * @param parent the plain internal name of the parent class + * @param name the field name + * @param descriptor the descriptor of the member (only for methods) * @return the obfuscated name of the given member * @throws MappingNotFoundException if no mapping is found */ - String obfuscateMember(String parentName, String memberName, String methodDescriptor) throws MappingNotFoundException; + MethodData getMethodData(String parent, String name, String descriptor) throws MappingNotFoundException; /** - * Gets the plain name of a class member (field or method). - * @param parentName the obfuscated internal name of the parent class - * @param memberName the obfuscated field name or method signature - * @param methodDescriptor the obfuscated descriptor of the member (only for methods) - * @return the plain name of the given member + * Gets the obfuscated name of a class member (field or method). + * @param parent the plain internal name of the parent class + * @param name the field name + * @return the obfuscated name of the given member * @throws MappingNotFoundException if no mapping is found */ - String deobfuscateMember(String parentName, String memberName, String methodDescriptor) throws MappingNotFoundException; - + FieldData getFieldData(String parent, String name) throws MappingNotFoundException; } |