Package com.tonic.renamer.mapping
Class MappingStore
- java.lang.Object
-
- com.tonic.renamer.mapping.MappingStore
-
public class MappingStore extends Object
Container for all rename mappings with efficient lookup capabilities.
-
-
Constructor Summary
Constructors Constructor Description MappingStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MappingStoreaddClassMapping(ClassMapping mapping)Adds a class mapping.MappingStoreaddFieldMapping(FieldMapping mapping)Adds a field mapping.MappingStoreaddMethodMapping(MethodMapping mapping)Adds a method mapping.voidclear()Clears all mappings.StringgetClassMapping(String oldName)Resolves the replacement name for a class.Collection<ClassMapping>getClassMappings()FieldMappinggetFieldMapping(String owner, String name, String descriptor)Looks up the mapping registered for one field.Collection<FieldMapping>getFieldMappings()MethodMappinggetMethodMapping(String owner, String name, String descriptor)Looks up the mapping registered for one method.Collection<MethodMapping>getMethodMappings()booleanhasClassMapping(String oldName)Reports whether a class is mapped.booleanhasFieldMapping(String owner, String name, String descriptor)Reports whether a field is mapped.booleanhasMethodMapping(String owner, String name, String descriptor)Reports whether a method is mapped.booleanisEmpty()intsize()StringtoString()
-
-
-
Method Detail
-
addClassMapping
public MappingStore addClassMapping(ClassMapping mapping)
Adds a class mapping.- Parameters:
mapping- The class mapping to add- Returns:
- this for fluent chaining
-
addMethodMapping
public MappingStore addMethodMapping(MethodMapping mapping)
Adds a method mapping.- Parameters:
mapping- The method mapping to add- Returns:
- this for fluent chaining
-
addFieldMapping
public MappingStore addFieldMapping(FieldMapping mapping)
Adds a field mapping.- Parameters:
mapping- The field mapping to add- Returns:
- this for fluent chaining
-
getClassMapping
public String getClassMapping(String oldName)
Resolves the replacement name for a class.- Parameters:
oldName- the original class name- Returns:
- the new name, or null if the class is unmapped
-
getMethodMapping
public MethodMapping getMethodMapping(String owner, String name, String descriptor)
Looks up the mapping registered for one method.- Parameters:
owner- the declaring class namename- the original method namedescriptor- the method descriptor- Returns:
- the mapping, or null if the method is unmapped
-
getFieldMapping
public FieldMapping getFieldMapping(String owner, String name, String descriptor)
Looks up the mapping registered for one field.- Parameters:
owner- the declaring class namename- the original field namedescriptor- the field descriptor- Returns:
- the mapping, or null if the field is unmapped
-
hasClassMapping
public boolean hasClassMapping(String oldName)
Reports whether a class is mapped.- Parameters:
oldName- the original class name- Returns:
- true if a mapping is registered for it
-
hasMethodMapping
public boolean hasMethodMapping(String owner, String name, String descriptor)
Reports whether a method is mapped.- Parameters:
owner- the declaring class namename- the original method namedescriptor- the method descriptor- Returns:
- true if a mapping is registered for it
-
hasFieldMapping
public boolean hasFieldMapping(String owner, String name, String descriptor)
Reports whether a field is mapped.- Parameters:
owner- the declaring class namename- the original field namedescriptor- the field descriptor- Returns:
- true if a mapping is registered for it
-
getClassMappings
public Collection<ClassMapping> getClassMappings()
- Returns:
- an unmodifiable view of the class mappings in insertion order
-
getMethodMappings
public Collection<MethodMapping> getMethodMappings()
- Returns:
- an unmodifiable view of the method mappings in insertion order
-
getFieldMappings
public Collection<FieldMapping> getFieldMappings()
- Returns:
- an unmodifiable view of the field mappings in insertion order
-
size
public int size()
- Returns:
- the class, method and field mapping counts added together
-
isEmpty
public boolean isEmpty()
- Returns:
- true if no class, method or field mapping is registered
-
clear
public void clear()
Clears all mappings.
-
-