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 合併指標
 (平均合併 8天) (30 天內合併 14 個 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"));

貢獻者指南