|
28 | 28 | import java.nio.file.Path;
|
29 | 29 | import java.nio.file.Paths;
|
30 | 30 | import java.util.ArrayList;
|
31 |
| -import java.util.Collections; |
32 | 31 | import java.util.Comparator;
|
33 | 32 | import java.util.HashMap;
|
34 | 33 | import java.util.List;
|
@@ -71,7 +70,7 @@ public static void main(String[] args) {
|
71 | 70 |
|
72 | 71 | protected static final String KEY = "key";
|
73 | 72 |
|
74 |
| - enum Mode { |
| 73 | + public enum Mode { |
75 | 74 | maven,
|
76 | 75 | resolver
|
77 | 76 | }
|
@@ -125,7 +124,7 @@ public Integer call() {
|
125 | 124 | }
|
126 | 125 | }
|
127 | 126 |
|
128 |
| - Collections.sort(discoveredKeys, Comparator.comparing(e -> e.get(KEY))); |
| 127 | + discoveredKeys.sort(Comparator.comparing(e -> e.get(KEY))); |
129 | 128 |
|
130 | 129 | Properties properties = new Properties();
|
131 | 130 | properties.setProperty("resource.loaders", "classpath");
|
@@ -194,24 +193,22 @@ public void visitEnd() {
|
194 | 193 | .getFullText()
|
195 | 194 | .replace("*", "\\*");
|
196 | 195 | String since = getSince(f);
|
197 |
| - String source = |
198 |
| - switch ((values.get("source") != null |
199 |
| - ? (String) values.get("source") |
200 |
| - : "USER_PROPERTIES") // TODO: enum |
201 |
| - .toLowerCase()) { |
202 |
| - case "model" -> "Model properties"; |
203 |
| - case "user_properties" -> "User properties"; |
204 |
| - default -> throw new IllegalStateException(); |
205 |
| - }; |
206 |
| - String type = |
207 |
| - switch ((values.get("type") != null |
208 |
| - ? (String) values.get("type") |
209 |
| - : "java.lang.String")) { |
210 |
| - case "java.lang.String" -> "String"; |
211 |
| - case "java.lang.Integer" -> "Integer"; |
212 |
| - case "java.lang.Boolean" -> "Boolean"; |
213 |
| - default -> throw new IllegalStateException(); |
214 |
| - }; |
| 196 | + String source = (values.get("source") != null |
| 197 | + ? (String) values.get("source") |
| 198 | + : "USER_PROPERTIES") // TODO: enum |
| 199 | + .toLowerCase(); |
| 200 | + source = switch (source) { |
| 201 | + case "model" -> "Model properties"; |
| 202 | + case "user_properties" -> "User properties"; |
| 203 | + default -> source;}; |
| 204 | + String type = (values.get("type") != null |
| 205 | + ? (String) values.get("type") |
| 206 | + : "java.lang.String"); |
| 207 | + if (type.startsWith("java.lang.")) { |
| 208 | + type = type.substring("java.lang.".length()); |
| 209 | + } else if (type.startsWith("java.util.")) { |
| 210 | + type = type.substring("java.util.".length()); |
| 211 | + } |
215 | 212 | discoveredKeys.add(Map.of(
|
216 | 213 | KEY,
|
217 | 214 | fieldValue.toString(),
|
|
0 commit comments