line/centraldogma

Add useful factory methods to `PathPattern`

オープン

#659 opened on 2021/12/24

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Java (133 件のフォーク)auto 404
good first issuenew feature

Repository metrics

Stars
 (664 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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"));

コントリビューターガイド