• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 25375856694

05 May 2026 12:17PM UTC coverage: 70.764% (+0.03%) from 70.733%
25375856694

Pull #1860

github

web-flow
Merge e45acb48b into 0a9d804f0
Pull Request #1860: #1685: Added Nest CLI to IDEasy commandlets

4410 of 6878 branches covered (64.12%)

Branch coverage included in aggregate %.

11357 of 15403 relevant lines covered (73.73%)

3.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.17
cli/src/main/java/com/devonfw/tools/ide/common/Tag.java
1
package com.devonfw.tools.ide.common;
2

3
import java.util.Collection;
4
import java.util.Collections;
5
import java.util.HashMap;
6
import java.util.HashSet;
7
import java.util.Locale;
8
import java.util.Map;
9
import java.util.Objects;
10
import java.util.Set;
11

12
/**
13
 * A {@link Tag} represents a classifier or category. A tool and plugin can be associated with {@link Tag}s allowing end users to find them.
14
 */
15
public final class Tag {
16

17
  private static final Tag[] NO_TAGS = new Tag[0];
3✔
18

19
  private static final Map<String, Tag> TAG_MAP = new HashMap<>(128);
5✔
20

21
  private static final Collection<Tag> ALL_TAGS = Collections.unmodifiableCollection(TAG_MAP.values());
4✔
22

23
  /** The root {@link Tag}. */
24
  public static final Tag ROOT = new Tag();
4✔
25

26
  static {
27
    TAG_MAP.put(ROOT.id, ROOT);
6✔
28
  }
29

30
  /** {@link #getParent() Parent} for miscellaneous (undefined) tags. */
31
  public static final Tag MISC = create("miscellaneous", ROOT, true, "misc");
6✔
32

33
  /** {@link #getParent() Parent} for programming-languages. */
34
  public static final Tag LANGUAGE = create("language", ROOT, true, "programming");
6✔
35

36
  /** {@link Tag} for JVM (Java Virtual Machine). */
37
  public static final Tag JVM = create("java-virtual-machine", LANGUAGE, false, "jvm");
6✔
38

39
  /** {@link Tag} for Java. */
40
  public static final Tag JAVA = create("java", JVM);
4✔
41

42
  /** {@link Tag} for Go. */
43
  public static final Tag GO = create("go", LANGUAGE);
4✔
44

45
  /** {@link Tag} for Kotlin. */
46
  public static final Tag KOTLIN = create("kotlin", JVM);
4✔
47

48
  /** {@link Tag} for Scala. */
49
  public static final Tag SCALA = create("scala", JVM);
4✔
50

51
  /** {@link Tag} for DotNet (.NET). */
52
  public static final Tag DOTNET = create("dotnet", LANGUAGE, false, "net");
6✔
53

54
  /** {@link Tag} for C#. */
55
  public static final Tag CS = create("c#", DOTNET, false, "cs", "csharp");
15✔
56

57
  /** {@link Tag} for C. */
58
  public static final Tag C = create("c", LANGUAGE);
4✔
59

60
  /** {@link Tag} for Rust. */
61
  public static final Tag RUST = create("rust", LANGUAGE, false, "rs");
6✔
62

63
  /** {@link Tag} for C++. */
64
  public static final Tag CPP = create("c++", LANGUAGE, false, "cpp");
6✔
65

66
  /** {@link Tag} for Python. */
67
  public static final Tag PYTHON = create("python", LANGUAGE);
4✔
68

69
  /** {@link Tag} for Ruby. */
70
  public static final Tag RUBY = create("ruby", LANGUAGE);
4✔
71

72
  /** {@link Tag} for Perl. */
73
  public static final Tag PERL = create("perl", LANGUAGE);
4✔
74

75
  /** {@link Tag} for Shell scripting. */
76
  public static final Tag SHELL = create("shell", JVM, false, "script");
6✔
77

78
  /** {@link Tag} for Bash. */
79
  public static final Tag BASH = create("bash", SHELL, false, "terminal");
6✔
80

81
  /** {@link Tag} for TypeScript. */
82
  public static final Tag JAVA_SCRIPT = create("javascript", LANGUAGE, false, "js");
6✔
83

84
  /** {@link Tag} for TypeScript. */
85
  public static final Tag TYPE_SCRIPT = create("typescript", JAVA_SCRIPT, false, "ts");
6✔
86

87
  /** {@link #getParent() Parent} for programming-languages. */
88
  public static final Tag IDE = create("ide", ROOT);
4✔
89

90
  /** {@link Tag} for Eclipse. */
91
  public static final Tag ECLIPSE = create("eclipse", IDE);
4✔
92

93
  /** {@link Tag} for IDEA (JetBrains IDE Platform). */
94
  public static final Tag IDEA = create("idea", IDE);
4✔
95

96
  /** {@link Tag} for IntelliJ. */
97
  public static final Tag INTELLIJ = create("intellij", IDEA);
4✔
98

99
  /** {@link Tag} for Android-Studio. */
100
  public static final Tag ANDROID_STUDIO = create("android-studio", IDEA);
4✔
101

102
  /** {@link Tag} for Pycharm. */
103
  public static final Tag PYCHARM = create("pycharm", IDEA);
4✔
104

105
  /** {@link Tag} for VS-Code. */
106
  public static final Tag VS_CODE = create("vscode", IDE, false, "visualstudiocode");
6✔
107

108
  /** {@link Tag} for (code-)generators (including template-engines, etc.). */
109
  public static final Tag GENERATOR = create("generator", ROOT);
4✔
110

111
  /** {@link #getParent() Parent} for frameworks. */
112
  public static final Tag FRAMEWORK = create("framework", ROOT, true);
5✔
113

114
  /** {@link Tag} for Spring(framework). */
115
  public static final Tag SPRING = create("spring", FRAMEWORK, false, new String[] { "springframework", "springboot" },
21✔
116
      JAVA);
117

118
  /** {@link Tag} for Quarkus. */
119
  public static final Tag QUARKUS = create("quarkus", FRAMEWORK, false, null, JAVA);
12✔
120

121
  /** {@link Tag} for Micronaut. */
122
  public static final Tag MICRONAUT = create("micronaut", FRAMEWORK, false, null, JAVA);
12✔
123

124
  /** {@link Tag} for Angular. */
125
  public static final Tag ANGULAR = create("angular", FRAMEWORK, false, new String[] { "ng", "angularjs" },
21✔
126
      TYPE_SCRIPT);
127

128
  /** {@link Tag} for React. */
129
  public static final Tag REACT = create("react", FRAMEWORK, false, null, TYPE_SCRIPT);
12✔
130

131
  /** {@link Tag} for Vue. */
132
  public static final Tag VUE = create("vue", FRAMEWORK, false, null, TYPE_SCRIPT);
12✔
133

134
  /** {@link Tag} for Cordova. */
135
  public static final Tag CORDOVA = create("cordova", FRAMEWORK, false, null, JAVA_SCRIPT);
12✔
136

137
  /** {@link Tag} for Ionic. */
138
  public static final Tag IONIC = create("ionic", CORDOVA, false);
5✔
139

140
  /** {@link #getParent() Parent} for quality-assurance. */
141
  public static final Tag QA = create("quality-assurance", ROOT, false, "qa", "quality");
15✔
142

143
  /** {@link Tag} for everything related to testing. */
144
  public static final Tag TEST = create("testing", QA, false, "test");
6✔
145

146
  /** {@link Tag} for everything related to testing. */
147
  public static final Tag MOCK = create("mocking", TEST, false, "mock");
6✔
148

149
  /** {@link Tag} for everything related to testing. */
150
  public static final Tag CODE_QA = create("static-code-analysis", QA, false, "codeqa");
6✔
151

152
  /** {@link #getParent() Parent} for linters. */
153
  public static final Tag LINTING = create("linter", QA, false, "lint", "linting");
15✔
154

155
  /** {@link Tag} for everything related to documentation. */
156
  public static final Tag DOCUMENTATION = create("documentation", ROOT, false, "doc");
6✔
157

158
  /** {@link #getParent() Parent} for file formats. */
159
  public static final Tag FORMAT = create("format", ROOT, true);
5✔
160

161
  /** {@link Tag} for JSON. */
162
  public static final Tag JSON = create("json", FORMAT);
4✔
163

164
  /** {@link Tag} for YAML. */
165
  public static final Tag YAML = create("yaml", FORMAT, false, "yml");
6✔
166

167
  /** {@link Tag} for CSS. */
168
  public static final Tag CSS = create("css", FORMAT);
4✔
169

170
  /** {@link Tag} for Properties. */
171
  public static final Tag PROPERTIES = create("properties", FORMAT);
4✔
172

173
  /** {@link Tag} for AsciiDoc. */
174
  public static final Tag ASCII_DOC = create("ascii-doc", FORMAT, false, new String[] { "adoc" }, DOCUMENTATION);
17✔
175

176
  /** {@link Tag} for MarkDown. */
177
  public static final Tag MARK_DOWN = create("markdown", DOCUMENTATION, false, new String[] { "md" }, DOCUMENTATION);
17✔
178

179
  /** {@link Tag} for YAML. */
180
  public static final Tag PDF = create("pdf", FORMAT, false, null, DOCUMENTATION);
12✔
181

182
  /** {@link Tag} for HTML. */
183
  public static final Tag HTML = create("html", FORMAT, false, null, DOCUMENTATION);
12✔
184

185
  /** {@link Tag} for machine-learning. */
186
  public static final Tag MACHINE_LEARNING = create("machine-learning", ROOT, false, "ml");
6✔
187

188
  /** {@link Tag} for artificial-intelligence. */
189
  public static final Tag ARTIFICIAL_INTELLIGENCE = create("artificial-intelligence", MACHINE_LEARNING, false, "ai");
6✔
190

191
  /** {@link Tag} for data-science. */
192
  public static final Tag DATA_SCIENCE = create("data-science", ROOT);
4✔
193

194
  /** {@link Tag} for business-intelligence. */
195
  public static final Tag BUSINESS_INTELLIGENCE = create("business-intelligence", ROOT, false, "bi", "datawarehouse",
19✔
196
      "dwh");
197

198
  /** {@link #Tag} for productivity. */
199
  public static final Tag ARCHITECTURE = create("architecture", ROOT);
4✔
200

201
  /** {@link Tag} for AsciiDoc. */
202
  public static final Tag UML = create("uml", ARCHITECTURE, false, null, DOCUMENTATION);
12✔
203

204
  /** {@link #Tag} for security. */
205
  public static final Tag SECURITY = create("security", ROOT, false, "cve");
6✔
206

207
  /** {@link #Tag} for collaboration. */
208
  public static final Tag COLLABORATION = create("collaboration", ROOT, false, "collab");
6✔
209

210
  /** {@link #Tag} for virtualization. */
211
  public static final Tag VIRTUALIZATION = create("virtualization", ROOT, false, "vm");
6✔
212

213
  /** {@link #Tag} for docker. */
214
  public static final Tag DOCKER = create("docker", VIRTUALIZATION);
4✔
215

216
  /** {@link #Tag} for docker. */
217
  public static final Tag KUBERNETES = create("kubernetes", DOCKER, false, "k8s");
6✔
218

219
  /** {@link #Tag} for WSL. */
220
  public static final Tag WSL = create("wsl", VIRTUALIZATION);
4✔
221

222
  /** {@link Tag} for everything related to databases. */
223
  public static final Tag DB = create("database", ROOT);
4✔
224

225
  /** {@link Tag} for administration tools. */
226
  public static final Tag ADMIN = create("admin", ROOT);
4✔
227

228
  /** {@link #Tag} for network. */
229
  public static final Tag NETWORK = create("network", ROOT, false, "remote");
6✔
230

231
  /** {@link #Tag} for HTTP. */
232
  public static final Tag HTTP = create("http", NETWORK);
4✔
233

234
  /** {@link #Tag} for REST. */
235
  public static final Tag REST = create("rest", HTTP);
4✔
236

237
  /** {@link #Tag} for secure-shell. */
238
  public static final Tag SSH = create("secure-shell", NETWORK, false, "ssh", "scp");
15✔
239

240
  /** {@link #Tag} for capture. */
241
  public static final Tag CAPTURE = create("capture", ROOT, false, "capturing");
6✔
242

243
  /** {@link #Tag} for capture. */
244
  public static final Tag SCREENSHOT = create("screenshot", CAPTURE);
4✔
245

246
  /** {@link #Tag} for capture. */
247
  public static final Tag SCREEN_RECORDING = create("screenrecording", CAPTURE, false, "videocapture");
6✔
248

249
  /** {@link #Tag} for productivity. */
250
  public static final Tag PRODUCTIVITY = create("productivity", ROOT);
4✔
251

252
  /** {@link #Tag} for regular-expression. */
253
  public static final Tag REGEX = create("regular-expression", PRODUCTIVITY, false, "regex", "regexp");
15✔
254

255
  /** {@link #Tag} for search. */
256
  public static final Tag SEARCH = create("search", PRODUCTIVITY, false, "find");
6✔
257

258
  /** {@link #Tag} for spellchecker. */
259
  public static final Tag SPELLCHECKER = create("spellchecker", PRODUCTIVITY, false, "spellcheck", "spellchecking");
15✔
260

261
  /** {@link #Tag} for analyse. */
262
  public static final Tag ANALYSE = create("analyse", ROOT, false, "analyze", "analysis");
15✔
263

264
  /** {@link #Tag} for monitoring. */
265
  public static final Tag MONITORING = create("monitoring", ANALYSE, false, "monitor");
6✔
266

267
  /** {@link #Tag} for formatter. */
268
  public static final Tag FORMATTER = create("formatter", ROOT, false, "codeformat", "codeformatter");
15✔
269

270
  /** {@link #Tag} for user-experience. */
271
  public static final Tag UX = create("user-experience", PRODUCTIVITY, false, "ux");
6✔
272

273
  /** {@link #Tag} for style. */
274
  public static final Tag STYLE = create("style", UX, false, "theme", "icon", "skin");
19✔
275

276
  /** {@link #Tag} for style. */
277
  public static final Tag KEYBINDING = create("keybinding", UX, false, "keybindings", "keymap");
15✔
278

279
  /** {@link #Tag} for draw(ing). */
280
  public static final Tag DRAW = create("draw", UX, false, "diagram", "paint");
15✔
281

282
  /** {@link #Tag} for cloud. */
283
  public static final Tag CLOUD = create("cloud", ROOT);
4✔
284

285
  /** {@link #Tag} for infrastructure-as-code. */
286
  public static final Tag IAC = create("infrastructure-as-code", CLOUD, false, "iac");
6✔
287

288
  /** {@link #Tag} for software-configuration-management. */
289
  public static final Tag CONFIG_MANAGEMENT = create("software-configuration-management", ROOT, false,
15✔
290
      "configmanagement", "configurationmanagement");
291

292
  /** {@link #Tag} for build-management. */
293
  public static final Tag BUILD = create("build-management", CONFIG_MANAGEMENT, false, "build");
6✔
294

295
  /** {@link #Tag} for version-control. */
296
  public static final Tag VCS = create("version-control", CONFIG_MANAGEMENT, false, "vcs", "versioncontrolsystem");
15✔
297

298
  /** {@link #Tag} for issue-management. */
299
  public static final Tag ISSUE = create("issue-management", CONFIG_MANAGEMENT, false, "issue");
6✔
300

301
  /** {@link #Tag} for git. */
302
  public static final Tag GIT = create("git", VCS);
4✔
303

304
  /** {@link #Tag} for github. */
305
  public static final Tag GITHUB = create("github", GIT);
4✔
306

307

308
  /** {@link #Tag} for diff (tools that compare files and determine the difference). */
309
  public static final Tag DIFF = create("diff", CONFIG_MANAGEMENT, false, "patch");
6✔
310

311
  /** {@link #Tag} for diff (tools that compare files and determine the difference). */
312
  public static final Tag RUNTIME = create("runtime", ROOT);
4✔
313

314
  /** {@link #getParent() Parent} for operating-system. */
315
  public static final Tag OS = create("operating-system", ROOT, true, "os");
6✔
316

317
  /** {@link #Tag} for Windows. */
318
  public static final Tag WINDOWS = create("windows", OS);
4✔
319

320
  /** {@link #Tag} for Mac. */
321
  public static final Tag MAC = create("mac", OS, false, "macos", "osx");
15✔
322

323
  /** {@link #Tag} for Linux. */
324
  public static final Tag LINUX = create("linux", OS, false);
5✔
325

326
  /** {@link #getParent() Parent} for cryptography. */
327
  public static final Tag CRYPTO = create("cryptography", ROOT, false, "crypto");
6✔
328

329
  /** {@link #Tag} for encryption. */
330
  public static final Tag ENCRYPTION = create("encryption", CRYPTO);
4✔
331

332
  /** {@link Tag} for Nest. */
333
  public static final Tag NEST = create("nest", FRAMEWORK, false, new String[] { "nestjs", "nestcli" }, TYPE_SCRIPT);
22✔
334

335
  private final String id;
336

337
  private final Tag parent;
338

339
  private final boolean isAbstract;
340

341
  private final Tag[] additionalParents;
342

343
  private Tag() {
2✔
344

345
    this.id = "<root>";
3✔
346
    this.parent = null;
3✔
347
    this.isAbstract = true;
3✔
348
    this.additionalParents = NO_TAGS;
3✔
349
  }
1✔
350

351
  private Tag(String id, Tag parent, boolean isAbstract, Tag... additionalParents) {
352

353
    super();
2✔
354
    Objects.requireNonNull(id);
3✔
355
    Objects.requireNonNull(parent);
3✔
356
    assert (id.toLowerCase(Locale.ROOT).equals(id));
7!
357
    this.id = id;
3✔
358
    this.parent = parent;
3✔
359
    this.isAbstract = isAbstract;
3✔
360
    this.additionalParents = additionalParents;
3✔
361
  }
1✔
362

363
  /**
364
   * @return the identifier and name of this tag.
365
   */
366
  public String getId() {
367

368
    return this.id;
3✔
369
  }
370

371
  /**
372
   * @return the parent {@link Tag} or {@code null} if this is the root tag.
373
   */
374
  public Tag getParent() {
375

376
    return this.parent;
3✔
377
  }
378

379
  /**
380
   * @param i the index of the requested parent. Should be in the range from {@code 0} to
381
   *     <code>{@link #getParentCount()}-1</code>.
382
   * @return the requested {@link Tag}.
383
   */
384
  public Tag getParent(int i) {
385

386
    if (i == 0) {
2✔
387
      return this.parent;
3✔
388
    }
389
    return this.additionalParents[i - 1];
7✔
390
  }
391

392
  /**
393
   * @return the number of {@link #getParent(int) parents} available.
394
   */
395
  public int getParentCount() {
396

397
    if (this.parent == null) {
3✔
398
      return 0;
2✔
399
    }
400
    return this.additionalParents.length + 1;
6✔
401
  }
402

403
  /**
404
   * @return {@code true} if this {@link Tag} is abstract and cannot be selected since it is just a generic parent container, {@code false} otherwise.
405
   */
406
  public boolean isAbstract() {
407

408
    return this.isAbstract;
3✔
409
  }
410

411
  public boolean isAncestorOf(Tag tag) {
412

413
    return isAncestorOf(tag, false);
5✔
414
  }
415

416
  /**
417
   * @param tag the {@link Tag} to check.
418
   * @param includeAdditionalParents - {@code true} if {@link #getParent(int) additional parents} should be included, {@code false} otherwise (only consider
419
   *     {@link #getParent() primary parent}).
420
   * @return {@code true} if the given {@link Tag} is an ancestor of this tag, {@code false} otherwise. An ancestor is a direct or indirect
421
   *     {@link #getParent() parent}. Therefore, if {@link #ROOT} is given as {@link Tag} parameter, this method should always return {@code true}.
422
   */
423
  public boolean isAncestorOf(Tag tag, boolean includeAdditionalParents) {
424

425
    Tag ancestor = this.parent;
3✔
426
    while (ancestor != null) {
2✔
427
      if (ancestor == tag) {
3✔
428
        return true;
2✔
429
      }
430
      ancestor = ancestor.parent;
4✔
431
    }
432
    if (includeAdditionalParents) {
2✔
433
      for (Tag p : this.additionalParents) {
17✔
434
        do {
435
          if (p == tag) {
3✔
436
            return true;
2✔
437
          }
438
          p = p.parent;
3✔
439
        } while (p != null);
2✔
440
      }
441
    }
442
    return false;
2✔
443
  }
444

445
  @Override
446
  public String toString() {
447

448
    return this.id;
3✔
449
  }
450

451
  /**
452
   * @param id the {@link #getId() ID} of the tag.
453
   * @param parent the {@link #getParent() parent tag}.
454
   * @return the new {@link Tag}.
455
   */
456
  static Tag create(String id, Tag parent) {
457

458
    return create(id, parent, false);
5✔
459
  }
460

461
  /**
462
   * @param id the {@link #getId() ID} of the tag.
463
   * @param parent the {@link #getParent() parent tag}.
464
   * @param isAbstract the {@link #isAbstract() abstract flag}.
465
   * @return the new {@link Tag}.
466
   */
467
  static Tag create(String id, Tag parent, boolean isAbstract) {
468

469
    return create(id, parent, isAbstract, null, NO_TAGS);
7✔
470
  }
471

472
  /**
473
   * @param id the {@link #getId() ID} of the tag.
474
   * @param parent the {@link #getParent() parent tag}.
475
   * @param isAbstract the {@link #isAbstract() abstract flag}.
476
   * @return the new {@link Tag}.
477
   */
478
  static Tag create(String id, Tag parent, boolean isAbstract, String synonym) {
479

480
    return create(id, parent, isAbstract, new String[] { synonym }, NO_TAGS);
12✔
481
  }
482

483
  /**
484
   * @param id the {@link #getId() ID} of the tag.
485
   * @param parent the {@link #getParent() parent tag}.
486
   * @param isAbstract the {@link #isAbstract() abstract flag}.
487
   * @return the new {@link Tag}.
488
   */
489
  static Tag create(String id, Tag parent, boolean isAbstract, String... synonyms) {
490

491
    return create(id, parent, isAbstract, synonyms, NO_TAGS);
7✔
492
  }
493

494
  /**
495
   * @param id the {@link #getId() ID} of the tag.
496
   * @param parent the {@link #getParent() parent tag}.
497
   * @param isAbstract the {@link #isAbstract() abstract flag}.
498
   * @return the new {@link Tag}.
499
   */
500
  static Tag create(String id, Tag parent, boolean isAbstract, String[] synonyms, Tag... additionalParents) {
501

502
    Tag tag = new Tag(id, parent, isAbstract, additionalParents);
8✔
503
    add(id, tag);
3✔
504
    if (synonyms != null) {
2✔
505
      for (String synonym : synonyms) {
16✔
506
        add(synonym, tag);
3✔
507
      }
508
    }
509
    return tag;
2✔
510
  }
511

512
  private static void add(String key, Tag tag) {
513

514
    Tag duplicate = TAG_MAP.put(normalizeKey(key), tag);
7✔
515
    if (duplicate != null) {
2✔
516
      throw new IllegalStateException("Duplicate tag for " + key);
6✔
517
    }
518
  }
1✔
519

520
  private static String normalizeKey(String key) {
521

522
    return key.replace("-", "").replace(".", "");
8✔
523
  }
524

525
  private static Tag require(String key) {
526

527
    Tag tag = TAG_MAP.get(normalizeKey(key));
6✔
528
    if (tag == null) {
2!
529
      throw new IllegalStateException("Could not find required tag " + key);
×
530
    }
531
    return tag;
2✔
532
  }
533

534
  /**
535
   * @param id the {@link #getId() ID} of the requested {@link Tag}.
536
   * @return the {@link Tag} with the given {@link #getId() ID}. Will be lazily created as child of {@link #MISC} if not already exists.
537
   */
538
  public static Tag of(String id) {
539

540
    final String tagId = id.trim();
3✔
541
    int slash = tagId.indexOf('/');
4✔
542
    if (slash >= 0) {
2✔
543
      String parentId = tagId.substring(0, slash);
5✔
544
      Tag parent = require(parentId);
3✔
545
      String childId = tagId.substring(slash + 1);
6✔
546
      return TAG_MAP.computeIfAbsent(normalizeKey(childId), i -> new Tag(childId, parent, false, NO_TAGS));
17✔
547
    }
548
    return TAG_MAP.computeIfAbsent(normalizeKey(tagId), i -> new Tag(tagId, MISC, false, NO_TAGS));
16✔
549
  }
550

551
  /**
552
   * @return the {@link Collections} of all available {@link Tag}s.
553
   */
554
  public static Collection<Tag> getAll() {
555

556
    return ALL_TAGS;
2✔
557
  }
558

559
  /**
560
   * @param tagsCsv the tags as {@link String} in CSV format («first-tag»,...,«last-tag»). May be {@code null} or empty.
561
   * @return the parsed {@link Set} of {@link Tag}s.
562
   */
563
  public static Set<Tag> parseCsv(String tagsCsv) {
564

565
    if (tagsCsv == null) {
2✔
566
      return Collections.emptySet();
2✔
567
    }
568
    tagsCsv = tagsCsv.trim().toLowerCase(Locale.ROOT);
5✔
569
    if (tagsCsv.isEmpty()) {
3✔
570
      return Collections.emptySet();
2✔
571
    }
572
    String[] tagArray = tagsCsv.split(",");
4✔
573
    Set<Tag> tags = new HashSet<>(tagArray.length);
6✔
574
    for (String tag : tagArray) {
16✔
575
      tags.add(of(tag));
5✔
576
    }
577
    assert (tags.size() == tagArray.length);
6!
578
    return Set.of(tags.toArray(new Tag[tags.size()]));
8✔
579
  }
580

581
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc