Creates a new store path from a string representation. @param s the string representation, must be not null and fulfill certain requirements @throws IllegalArgumentException if the string is not valid
(String s)
| 62 | * @throws IllegalArgumentException if the string is not valid |
| 63 | */ |
| 64 | public static StorePath fromString(String s) { |
| 65 | if (s == null) { |
| 66 | throw new IllegalArgumentException("String is null"); |
| 67 | } |
| 68 | |
| 69 | var split = s.split(String.valueOf(SEPARATOR), -1); |
| 70 | |
| 71 | var names = |
| 72 | Arrays.stream(split).map(String::trim).map(String::toLowerCase).toList(); |
| 73 | if (names.stream().anyMatch(s1 -> s1.isEmpty())) { |
| 74 | throw new IllegalArgumentException("Name must not be empty"); |
| 75 | } |
| 76 | |
| 77 | return new StorePath(names); |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | public String toString() { |