-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common utility to parse conditional dependency config
- Loading branch information
1 parent
e7e74b8
commit 4b66d16
Showing
3 changed files
with
49 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/util/BootstrapUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.bootstrap.util; | ||
|
||
import io.quarkus.bootstrap.model.AppArtifactKey; | ||
import java.util.regex.Pattern; | ||
|
||
public class BootstrapUtils { | ||
|
||
private static Pattern splitByWs; | ||
|
||
public static String[] splitByWhitespace(String s) { | ||
if (s == null) { | ||
return null; | ||
} | ||
if (splitByWs == null) { | ||
splitByWs = Pattern.compile("\\s+"); | ||
} | ||
return splitByWs.split(s); | ||
} | ||
|
||
public static AppArtifactKey[] parseDependencyCondition(String s) { | ||
final String[] strArr = splitByWhitespace(s); | ||
if (strArr == null) { | ||
return null; | ||
} | ||
final AppArtifactKey[] keys = new AppArtifactKey[strArr.length]; | ||
for (int i = 0; i < strArr.length; ++i) { | ||
keys[i] = AppArtifactKey.fromString(strArr[i]); | ||
} | ||
return keys; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters