Class MappingStore


  • public class MappingStore
    extends Object
    Container for all rename mappings with efficient lookup capabilities.
    • Constructor Detail

      • MappingStore

        public MappingStore()
    • 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 name
        name - the original method name
        descriptor - 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 name
        name - the original field name
        descriptor - 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 name
        name - the original method name
        descriptor - 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 name
        name - the original field name
        descriptor - 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.