Add useful factory methods to `PathPattern`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 668
- Forks
- 135
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 7
Description
`PathPattern` is introduced in #651 to create complex path patterns easily.
We will provide more common patterns as factory methods.
```java
// *.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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the PathPattern implementation introduced in #651 and inspect its existing pattern-composition API. Add the requested factory methods and composition forms described in this issue, then verify that the listed path examples produce the intended matches; no tests or file paths are named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100