public static boolean isMatch()

in dubbo-admin-server/src/main/java/org/apache/dubbo/admin/model/store/mesh/virtualservice/match/DubboAttachmentMatch.java [43:75]


    public static boolean isMatch(DubboAttachmentMatch dubboAttachmentMatch, Map<String, String> eagleeyeContext, Map<String, String> dubboContext) {
        if (dubboAttachmentMatch.getDubbocontext() != null) {
            for (Map.Entry<String, StringMatch> stringStringMatchEntry : dubboAttachmentMatch.getDubbocontext().entrySet()) {
                String key = stringStringMatchEntry.getKey();
                StringMatch stringMatch = stringStringMatchEntry.getValue();

                String dubboContextValue = dubboContext.get(key);
                if (dubboContextValue == null) {
                    return false;
                }
                if (!StringMatch.isMatch(stringMatch, dubboContextValue)) {
                    return false;
                }
            }
        }

        if (dubboAttachmentMatch.getEagleeyecontext() != null) {
            for (Map.Entry<String, StringMatch> stringStringMatchEntry : dubboAttachmentMatch.getEagleeyecontext().entrySet()) {
                String key = stringStringMatchEntry.getKey();
                StringMatch stringMatch = stringStringMatchEntry.getValue();

                String eagleeyeContextValue = eagleeyeContext.get(key);
                if (eagleeyeContextValue == null) {
                    return false;
                }
                if (!StringMatch.isMatch(stringMatch, eagleeyeContextValue)) {
                    return false;
                }
            }
        }

        return true;
    }