Skip to content

Commit

Permalink
add overload
Browse files Browse the repository at this point in the history
Took 14 minutes
  • Loading branch information
duncpro committed Jan 14, 2022
1 parent 8755017 commit dd4756e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
36 changes: 6 additions & 30 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.duncpro"
version = "1.0-SNAPSHOT-3"
version = "1.0-SNAPSHOT-4"

repositories {
mavenCentral()
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/duncpro/jroute/route/Route.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ public Route(String routeString) {
.collect(toUnmodifiableList());
}

public List<String> extractVariables(String path) throws IllegalStateException {
return extractVariables(new Path(path));
}

/**
* Compiles a list of all the arguments contained within the given path.
* For example, consider the route string "/users/*\/pets/*" and the path "/users/duncan/pets/cocoa".
* The returned list would be ["duncan", "cocoa"].
* @throws IllegalStateException if the given {@code pathString} is not of the same form as this route.
*/
public List<String> extractVariables(String pathString) throws IllegalStateException {
final var path = new Path(pathString);
public List<String> extractVariables(Path path) throws IllegalStateException {

if (!JRouteUtilities.accepts(path, this)) {
throw new IllegalArgumentException("The given path does not follow the" +
Expand Down

0 comments on commit dd4756e

Please sign in to comment.