public ClassMap find(Class<?> srcClass, Class<?> destClass, String mapId) {
        final String key = keyFactory.createKey(srcClass, destClass, mapId);
        ClassMap mapping = classMappings.get(key);

        if (mapping == null) {
            mapping = findInterfaceMapping(destClass, srcClass, mapId);
            if (mapping != null) {
                ClassMap previous = classMappings.putIfAbsent(keyFactory.createKey(srcClass, destClass, mapId), mapping);
                if (previous != null) {
                    mapping = previous;
                }
            }
        }

        // one more try...
        // if the mapId is not null looking up a map is easy
        if (!MappingUtils.isBlankOrNull(mapId) && mapping == null) {
            // probably a more efficient way to do this...
            for (Entry<String, ClassMap> entry : classMappings.entrySet()) {
                ClassMap classMap = entry.getValue();
                if (StringUtils.equals(classMap.getMapId(), mapId)
                    && classMap.getSrcClassToMap().isAssignableFrom(srcClass)
                    && classMap.getDestClassToMap().isAssignableFrom(destClass)) {
                    return classMap;
                } else if (StringUtils.equals(classMap.getMapId(), mapId) && srcClass.equals(destClass)) {
                    return classMap;
                }
            }

            // If map-id was specified and mapping was not found, then fail
            MappingUtils.throwMappingException("Class mapping not found by map-id: " + key);
        }

        return mapping;
    }
Internal class that determines the appropriate class mapping to be used for
the source and destination object being mapped. Only intended for internal
use.
core/src/main/java/com/github/dozermapper/core/classmap/ClassMappings.java