line/centraldogma

Add useful factory methods to `PathPattern`

开放

#659 创建于 2021年12月24日

 (0 条评论) (0 个反应) (0 位负责人)Java (133 个派生)auto 404
good first issuenew feature

仓库指标

星标
 (664 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

PathPattern is introduced in #651 to create complex path patterns easily. We will provide more common patterns as factory methods.

// *.json
PathPattern.endsWith("json");
// /**/foo.txt
PathPattern.endsWith("foo.txt");

// /foo/bar/**
PathPattern.under("/foo/bar"); // or 
PathPattern.startsWith("/foo/bar");

// Compose the existing path patterns
// /foo/bar/**/*.json
PathPattern.startsWith("/foo/bar").endsWith("json"); // or 
PathPattern.builder()
           .startsWith("/foo/bar")
           .endsWith("json")
           .build();


// *.json and /foo/bar/**
PathPattern.of(PatternPattern.of("json"), PathPattern.startsWith("/foo/bar"));

贡献者指南