line/centraldogma

Add useful factory methods to `PathPattern`

Offen

#659 geöffnet am 24.12.2021

 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (133 Forks)auto 404
good first issuenew feature

Repository-Metriken

Stars
 (664 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 8T) (14 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide