static boolean matchesType()

in maven-resolver-util/src/main/java/org/eclipse/aether/util/repository/DefaultMirrorSelector.java [215:247]


    static boolean matchesType(String repoType, String mirrorType) {
        boolean result = false;

        // simple checks first to short circuit processing below.
        if (mirrorType == null || mirrorType.isEmpty() || WILDCARD.equals(mirrorType)) {
            result = true;
        } else if (mirrorType.equals(repoType)) {
            result = true;
        } else {
            // process the list
            String[] layouts = mirrorType.split(",");
            for (String layout : layouts) {
                // see if this is a negative match
                if (layout.length() > 1 && layout.startsWith("!")) {
                    if (layout.substring(1).equals(repoType)) {
                        // explicitly exclude. Set result and stop processing.
                        result = false;
                        break;
                    }
                }
                // check for exact match
                else if (layout.equals(repoType)) {
                    result = true;
                    break;
                } else if (WILDCARD.equals(layout)) {
                    result = true;
                    // don't stop processing in case a future segment explicitly excludes this repo
                }
            }
        }

        return result;
    }