class StdRestxRequestMatcher implements RestxRequestMatcher {

    @Override
    public Optional<? extends RestxRequestMatch> match(String method, String path) {
        if (!this.endpoint.getMethod().equals(method)) {
            return Optional.absent();
        }
        Matcher m = pattern.matcher(path);
        if (!m.matches()) {
            return Optional.absent();
        }

        ImmutableMap.Builder<String, String> params = ImmutableMap.builder();
        for (int i = 0; i < m.groupCount() && i < groupNames.size(); i++) {
             params.put(groupNames.get(i), m.group(i + 1));
        }

        return Optional.of(new StdRestxRequestMatch(this.endpoint.getPathPattern(), path, params.build()));
    }

    public  StdRestxRequestMatcher(Endpoint endpoint);
    public  StdRestxRequestMatcher(String method, String pathPattern);

}